자유게시판

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

작성자 정보

  • Elisa Bennetts 작성
  • 작성일

컨텐츠 정보

본문

360_F_314700448_Ckh3uDxLuKEwPNGHIKF1ZgRwuVStqSft.jpgWe have now found two use-after-free vulnerabilities in PHP’s garbage assortment algorithm. Those vulnerabilities have been remotely exploitable over PHP’s unserialize function. We had been also awarded with $2,000 by the Internet Bug Bounty committee (c.f. Many thanks exit to cutz for co-authoring this article. Pornhub’s bug bounty program and its comparatively high rewards on Hackerone caught our consideration. That’s why we have taken the perspective of a sophisticated attacker with the complete intent to get as deep as potential into the system, specializing in one fundamental 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 instances a parameter named "cookie" received unserialized from Post knowledge and afterwards reflected by way of Set-Cookie headers. Standard exploitation strategies require so referred to as Property-Oriented-Programming (POP) that involve abusing already present courses with specifically defined "magic methods" so as to set off unwanted and malicious code paths.



b9404ca05d4b26a9c18a3f4577b1b9da.10.jpgUnfortunately, it was troublesome for us to collect any details about Pornhub’s used frameworks and PHP objects normally. Multiple lessons from frequent frameworks have been tested - all with out success. The core unserializer alone is relatively complicated because it includes greater than 1200 lines of code in PHP 5.6. Further, many internal PHP classes have their own unserialize methods. By supporting constructions like objects, arrays, integers, strings and even references it is no shock that PHP’s monitor record reveals a tendency for bugs and memory corruption vulnerabilities. Sadly, there have been no identified vulnerabilities of such type for newer PHP variations like PHP 5.6 or PHP 7, especially as a result of unserialize already got numerous attention up to now (e.g. phpcodz). Hence, auditing it can be in comparison with squeezing an already tightly squeezed lemon. Finally, after so much attention and so many safety fixes its vulnerability potential should have been drained out and it ought to be safe, shouldn’t it? To seek out an answer Dario applied a fuzzer crafted specifically for fuzzing serialized strings which were handed to unserialize.

wordpress.org

Running the fuzzer with PHP 7 instantly lead to unexpected conduct. This habits was not reproducible when tested against Pornhub’s server though. Thus, we assumed a PHP 5 model. However, operating the fuzzer in opposition to a newer version of PHP 5 just generated more than 1 TB of logs without any success. Eventually, after putting increasingly effort into fuzzing we’ve stumbled upon unexpected habits once more. Several questions needed to be answered: is the difficulty safety related? In that case can we solely exploit it locally or additionally remotely? To further complicate this case the fuzzer did generate non-printable knowledge blobs with sizes of greater than 200 KB. An incredible period of time was crucial to research potential points. In any case, xnxx 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 found that the foundation trigger might be found in PHP’s rubbish collection algorithm, a part of PHP that is completely unrelated to unserialize.



However, the interaction of each components occurred solely after unserialize had completed its job. Consequently, it was not properly suited to distant exploitation. After further evaluation, gaining a deeper understanding for the problem’s root causes and a number of laborious work an analogous use-after-free vulnerability was found that appeared to be promising for remote exploitation. The high sophistication of the found PHP bugs and their discovery made it obligatory to jot down separate articles. You can learn more details in Dario’s fuzzing unserialize write-up. As well as, now we have written an article about Breaking PHP’s Garbage Collection and Unserialize. Even this promising use-after-free vulnerability was considerably troublesome to exploit. Particularly, it involved multiple exploitation levels. 1. The stack and heap (which additionally embody any potential consumer-input) as well as another writable segments are flagged non-executable (c.f. 2. Even in case you are in a position to manage the instruction pointer you want to know what you want to execute i.e. it is advisable have a legitimate handle of an executable memory section.

관련자료

댓글 0
등록된 댓글이 없습니다.
알림 0