관련뉴스
전문가들이 제공하는 다양한 정보

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

작성자 작성자 Katie · 작성일 작성일24-05-24 20:24 · 조회수 조회수 295

페이지 정보

본문

1476741245_PEPPER-PORN_low-res-1200x628.jpgWe have found two use-after-free vulnerabilities in PHP’s garbage collection algorithm. Those vulnerabilities were remotely exploitable over PHP’s unserialize perform. 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 attention. That’s why we have now taken the perspective of a sophisticated attacker with the full intent to get as deep as doable into the system, specializing in one predominant aim: gaining remote code execution capabilities. Thus, we left no stone unturned and porn attacked what Pornhub is built upon: PHP. After analyzing the platform we shortly detected the usage of unserialize on the web site. In all cases a parameter named "cookie" acquired unserialized from Post information and afterwards reflected by way of Set-Cookie headers. Standard exploitation strategies require so called Property-Oriented-Programming (POP) that contain abusing already existing courses with particularly outlined "magic methods" in order to set off unwanted and malicious code paths.



1452804214_untitled-article-1452434637-body-image-1452434925-1280x628.jpgUnfortunately, it was troublesome for us to collect any information about Pornhub’s used frameworks and PHP objects normally. Multiple lessons from widespread frameworks have been examined - all without success. The core unserializer alone is relatively complex because it includes more than 1200 lines of code in PHP 5.6. Further, many inside PHP lessons have their very own unserialize strategies. By supporting structures like objects, arrays, integers, strings and even references it is not any shock that PHP’s observe document reveals a tendency for bugs and memory corruption vulnerabilities. Sadly, there have been no identified vulnerabilities of such sort for newer PHP versions like PHP 5.6 or PHP 7, especially as a result of unserialize already got numerous consideration prior 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 ought to be safe, shouldn’t it? To search out a solution Dario carried out a fuzzer crafted specifically for fuzzing serialized strings which have been handed to unserialize.



Running the fuzzer with PHP 7 immediately result in unexpected conduct. This conduct was not reproducible when tested against 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 placing increasingly effort into fuzzing we’ve stumbled upon unexpected behavior once more. Several questions had to be answered: is the problem safety related? In that case can we only exploit it regionally or also remotely? To additional complicate this example the fuzzer did generate non-printable data blobs with sizes of greater than 200 KB. An amazing amount of time was crucial to analyze potential issues. After all, we might 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 basis trigger could possibly be found in PHP’s garbage collection algorithm, a element of PHP that is totally unrelated to unserialize.



However, the interaction of both parts occurred only after unserialize had finished its job. Consequently, it was not properly fitted to distant exploitation. After additional evaluation, gaining a deeper understanding for the problem’s root causes and numerous exhausting work the same use-after-free vulnerability was discovered that appeared to be promising for remote exploitation. The high sophistication of the discovered PHP bugs and their discovery made it necessary to put in writing separate articles. You possibly can learn extra particulars 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 considerably tough to use. Specifically, it involved a number of exploitation phases. 1. The stack and heap (which additionally embody any potential person-input) as well as some other writable segments are flagged non-executable (c.f. 2. Even if you're in a position to regulate the instruction pointer it's essential to know what you wish to execute i.e. it's essential to have a sound deal with of an executable reminiscence section.

댓글목록

등록된 댓글이 없습니다.