How we Broke PHP, Hacked Pornhub and Earned $20,000

페이지 정보

profile_image
작성자 Maximilian
댓글 0건 조회 41회 작성일 24-05-28 04:29

본문

2000x2000.8.jpgWe've got discovered two use-after-free vulnerabilities in PHP’s rubbish collection algorithm. Those vulnerabilities had been remotely exploitable over PHP’s unserialize perform. We were also awarded with $2,000 by the Internet Bug Bounty committee (c.f. Many thanks go out to cutz for co-authoring this article. Pornhub’s bug bounty program and its relatively high rewards on Hackerone caught our attention. That’s why we have now taken the angle of an advanced attacker with the full intent to get as deep as potential into the system, focusing on one most important purpose: gaining distant code execution capabilities. Thus, we left no stone unturned and attacked what Pornhub is built upon: PHP. After analyzing the platform we rapidly detected the usage of unserialize on the web site. In all cases a parameter named "cookie" obtained unserialized from Post knowledge and afterwards mirrored by way of Set-Cookie headers. Standard exploitation techniques require so referred to as Property-Oriented-Programming (POP) that involve abusing already existing courses with specifically defined "magic methods" as a way to trigger undesirable and malicious code paths.

10JPPORN1_SPAN-superJumbo.jpg

414_1000.jpgUnfortunately, it was tough for us to gather any information about Pornhub’s used frameworks and PHP objects generally. Multiple classes from common frameworks have been examined - all with out success. The core unserializer alone is relatively complicated because it involves more than 1200 lines of code in PHP 5.6. Further, many inside PHP courses have their own unserialize methods. By supporting buildings like objects, arrays, integers, strings and even references it is no shock that PHP’s monitor report shows a tendency for bugs and reminiscence corruption vulnerabilities. Sadly, there were no known vulnerabilities of such kind for newer PHP versions like PHP 5.6 or PHP 7, especially as a result of unserialize already bought loads of consideration up to now (e.g. phpcodz). Hence, auditing it can be compared to squeezing an already tightly squeezed lemon. Finally, after a lot consideration and so many safety fixes its vulnerability potential ought to have been drained out and it must be secure, shouldn’t it? To search out a solution Dario carried out a fuzzer crafted particularly for fuzzing serialized strings which were handed to unserialize.



Running the fuzzer with PHP 7 instantly lead to unexpected conduct. This habits was not reproducible when examined in opposition to Pornhub’s server although. Thus, we assumed a PHP 5 version. However, working the fuzzer in opposition to a newer version of PHP 5 simply generated greater than 1 TB of logs without any success. Eventually, after putting increasingly effort into fuzzing we’ve stumbled upon unexpected behavior again. Several questions needed to be answered: is the problem security related? In that case can we only exploit it locally or also remotely? To additional complicate this case the fuzzer did generate non-printable information blobs with sizes of more than 200 KB. An amazing period of time was essential to research potential issues. After all, we may extract a concise proof of idea of a working reminiscence corruption bug - a so called use-after-free vulnerability! Upon further investigation we discovered that the root cause may very well be found in PHP’s garbage collection algorithm, a part of PHP that is completely unrelated to unserialize.



However, the interaction of both parts occurred solely after unserialize had completed its job. Consequently, it was not well fitted to remote exploitation. After additional evaluation, gaining a deeper understanding for the problem’s root causes and loads of exhausting work an identical use-after-free vulnerability was discovered that seemed to be promising for remote exploitation. The high sophistication of the found PHP bugs and xhamster their discovery made it essential to write down separate articles. You possibly can read extra details in Dario’s fuzzing unserialize write-up. In addition, we have written an article about Breaking PHP’s Garbage Collection and Unserialize. Even this promising use-after-free vulnerability was significantly tough to exploit. Specifically, it concerned a number of exploitation phases. 1. The stack and heap (which additionally embrace any potential consumer-input) as well as every other writable segments are flagged non-executable (c.f. 2. Even if you're in a position to manage the instruction pointer you must know what you want to execute i.e. it's good to have a valid deal with of an executable memory segment.

댓글목록

등록된 댓글이 없습니다.