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

페이지 정보

profile_image
작성자 Jessie Maple
댓글 0건 조회 43회 작성일 24-05-28 20:21

본문

1476741245_PEPPER-PORN_low-res-1200x628.jpgWe now have discovered two use-after-free vulnerabilities in PHP’s rubbish collection algorithm. Those vulnerabilities had been remotely exploitable over PHP’s unserialize perform. We have been 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 excessive rewards on Hackerone caught our attention. That’s why we've taken the attitude of an advanced attacker with the complete intent to get as deep as doable into the system, specializing in one main objective: gaining remote code execution capabilities. Thus, we left no stone unturned and attacked what Pornhub is constructed upon: PHP. After analyzing the platform we shortly detected the usage of unserialize on the web site. In all cases a parameter named "cookie" got unserialized from Post information and afterwards reflected through Set-Cookie headers. Standard exploitation methods require so referred to as Property-Oriented-Programming (POP) that contain abusing already current courses with particularly outlined "magic methods" so as to trigger unwanted and malicious code paths.



2sSjaI7.jpgUnfortunately, it was tough for us to assemble any details about Pornhub’s used frameworks and PHP objects on the whole. Multiple courses from frequent frameworks have been examined - all with out success. The core unserializer alone is relatively advanced because it involves more than 1200 traces of code in PHP 5.6. Further, many inner PHP classes have their own unserialize strategies. By supporting structures like objects, arrays, integers, strings and even references it is no surprise that PHP’s monitor file exhibits a tendency for porn bugs and memory corruption vulnerabilities. Sadly, there were no recognized vulnerabilities of such sort for newer PHP variations like PHP 5.6 or PHP 7, particularly as a result of unserialize already acquired numerous consideration prior to now (e.g. phpcodz). Hence, auditing it can be in comparison with squeezing an already tightly squeezed lemon. Finally, after a lot attention and so many security fixes its vulnerability potential should have been drained out and it ought to be safe, shouldn’t it? To find an answer Dario applied a fuzzer crafted specifically for fuzzing serialized strings which had been passed to unserialize.

022962-470-porn_time_popcorn_time.jpg

Running the fuzzer with PHP 7 instantly lead to unexpected behavior. This habits was not reproducible when tested against Pornhub’s server although. Thus, we assumed a PHP 5 model. However, working the fuzzer against a newer version of PHP 5 just generated more than 1 TB of logs without any success. Eventually, after placing an increasing number of effort into fuzzing we’ve stumbled upon unexpected habits once more. Several questions had to be answered: is the problem safety associated? In that case can we solely exploit it regionally or also remotely? To further complicate this situation the fuzzer did generate non-printable knowledge blobs with sizes of more than 200 KB. An amazing period of time was necessary to research potential issues. In any case, we may extract a concise proof of idea of a working reminiscence corruption bug - a so referred to as use-after-free vulnerability! Upon further investigation we discovered that the root trigger could possibly be found in PHP’s garbage assortment algorithm, a element of PHP that is completely unrelated to unserialize.



However, the interplay of each elements occurred solely after unserialize had completed its job. Consequently, it was not effectively suited for distant exploitation. After further analysis, gaining a deeper understanding for the problem’s root causes and loads of arduous work an analogous use-after-free vulnerability was discovered that seemed to be promising for remote exploitation. The excessive sophistication of the found PHP bugs and their discovery made it vital to write down separate articles. You'll be able to read extra details in Dario’s fuzzing unserialize write-up. As well as, we have now written an article about Breaking PHP’s Garbage Collection and Unserialize. Even this promising use-after-free vulnerability was significantly troublesome to use. Specifically, it concerned a number of exploitation levels. 1. The stack and heap (which additionally embrace any potential person-input) as well as every other writable segments are flagged non-executable (c.f. 2. Even in case you are ready to manage the instruction pointer that you must know what you need to execute i.e. you might want to have a legitimate tackle of an executable memory section.

댓글목록

등록된 댓글이 없습니다.