자유게시판

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

작성자 정보

  • Pauline Deaton 작성
  • 작성일

컨텐츠 정보

본문

034_1000.jpgNow we have discovered two use-after-free vulnerabilities in PHP’s garbage collection algorithm. Those vulnerabilities have been remotely exploitable over PHP’s unserialize perform. We had been additionally awarded with $2,000 by the Internet Bug Bounty committee (c.f. Many thanks exit to cutz for co-authoring this text. Pornhub’s bug bounty program and its comparatively excessive rewards on Hackerone caught our consideration. That’s why we now have taken the angle of an advanced attacker with the total intent to get as deep as attainable into the system, specializing in one essential goal: gaining remote code execution capabilities. Thus, we left no stone unturned and attacked what Pornhub is constructed upon: PHP. After analyzing the platform we rapidly detected the usage of unserialize on the web site. In all circumstances a parameter named "cookie" acquired unserialized from Post data and afterwards mirrored through Set-Cookie headers. Standard exploitation techniques require so known as Property-Oriented-Programming (POP) that contain abusing already existing courses with particularly outlined "magic methods" with a view to set off undesirable and malicious code paths.



NFVTZ.jpgUnfortunately, it was tough for us to assemble any information about Pornhub’s used frameworks and PHP objects basically. Multiple courses from frequent frameworks have been tested - all without success. The core unserializer alone is comparatively advanced as it includes greater than 1200 strains of code in PHP 5.6. Further, many inner PHP classes have their very own unserialize strategies. By supporting structures like objects, arrays, integers, strings and even references it is no shock that PHP’s observe file reveals a tendency for bugs and museumbola reminiscence corruption vulnerabilities. Sadly, there have been no identified vulnerabilities of such type for newer PHP variations like PHP 5.6 or PHP 7, especially because unserialize already acquired plenty of consideration previously (e.g. phpcodz). Hence, auditing it may 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 should be safe, shouldn’t it? To find an answer Dario implemented a fuzzer crafted specifically for fuzzing serialized strings which were passed to unserialize.



Running the fuzzer with PHP 7 instantly result in unexpected conduct. This conduct was not reproducible when tested in opposition to Pornhub’s server although. Thus, we assumed a PHP 5 model. However, running the fuzzer in opposition to a newer model of PHP 5 just generated greater than 1 TB of logs without any success. Eventually, after putting an increasing number of effort into fuzzing we’ve stumbled upon unexpected behavior once more. Several questions needed to be answered: is the issue security related? If so can we solely exploit it domestically or also remotely? To additional complicate this case the fuzzer did generate non-printable information blobs with sizes of greater than 200 KB. An incredible amount of time was essential to analyze potential issues. After all, we could 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 found that the basis cause could be found in PHP’s garbage assortment algorithm, a part of PHP that is completely unrelated to unserialize.



However, the interplay of each elements occurred only after unserialize had finished its job. Consequently, it was not nicely suited to distant exploitation. After further analysis, gaining a deeper understanding for the problem’s root causes and quite a lot of laborious work an analogous use-after-free vulnerability was found that appeared to be promising for remote exploitation. The high sophistication of the discovered PHP bugs and their discovery made it mandatory to jot down separate articles. You possibly can learn more particulars in Dario’s fuzzing unserialize write-up. As well as, we now have written an article about Breaking PHP’s Garbage Collection and Unserialize. Even this promising use-after-free vulnerability was significantly troublesome to take advantage of. Particularly, it concerned a number of exploitation levels. 1. The stack and heap (which also embody any potential consumer-enter) as well as another writable segments are flagged non-executable (c.f. 2. Even if you are ready to control the instruction pointer it is advisable know what you wish to execute i.e. you should have a sound tackle of an executable reminiscence segment.

szkxBgZPM80

관련자료

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