How we Broke PHP, Hacked Pornhub and Earned $20,000
페이지 정보
작성자 Wilfredo 작성일24-06-01 00:18 조회3회 댓글0건본문
We've discovered two use-after-free vulnerabilities in PHP’s rubbish collection algorithm. Those vulnerabilities had been remotely exploitable over PHP’s unserialize function. We have been also 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 relatively high rewards on Hackerone caught our attention. That’s why now we have taken the perspective of an advanced attacker with the full intent to get as deep as attainable into the system, specializing in one foremost purpose: gaining remote code execution capabilities. Thus, we left no stone unturned and attacked what Pornhub is built upon: PHP. After analyzing the platform we quickly detected the utilization of unserialize on the web site. In all instances a parameter named "cookie" acquired unserialized from Post data and afterwards reflected by way of Set-Cookie headers. Standard exploitation techniques require so called Property-Oriented-Programming (POP) that contain abusing already current classes with particularly defined "magic methods" with a purpose to set off unwanted and malicious code paths.
Unfortunately, it was difficult for us to collect any information about Pornhub’s used frameworks and PHP objects generally. Multiple lessons from widespread frameworks have been tested - all with out success. The core unserializer alone is comparatively advanced as it includes greater than 1200 lines of code in PHP 5.6. Further, many inner PHP lessons have their own unserialize strategies. By supporting buildings like objects, arrays, integers, strings and even references it is no shock that PHP’s track record shows a tendency for bugs and reminiscence corruption vulnerabilities. Sadly, there have been no identified vulnerabilities of such type for newer PHP versions like PHP 5.6 or PHP 7, especially as a result of unserialize already received numerous attention in the past (e.g. phpcodz). Hence, auditing it may be compared to squeezing an already tightly squeezed lemon. Finally, after a lot consideration and so many safety fixes its vulnerability potential should have been drained out and it needs to be secure, shouldn’t it? To find an answer Dario applied a fuzzer crafted specifically for fuzzing serialized strings which have been handed to unserialize.
Running the fuzzer with PHP 7 immediately lead to unexpected habits. This behavior was not reproducible when examined against Pornhub’s server although. Thus, we assumed a PHP 5 model. However, working the fuzzer against a newer model of PHP 5 just generated greater than 1 TB of logs without any success. Eventually, after placing an increasing number of effort into fuzzing we’ve stumbled upon unexpected conduct once more. Several questions had to be answered: is the problem safety associated? In that case can we only exploit it locally or also remotely? To additional complicate this case the fuzzer did generate non-printable knowledge blobs with sizes of greater than 200 KB. A tremendous amount of time was mandatory to investigate potential issues. In any case, we could extract a concise proof of concept of a working memory corruption bug - a so known as use-after-free vulnerability! Upon further investigation we found that the root cause might be found in PHP’s garbage collection algorithm, a part of PHP that is totally unrelated to unserialize.
However, the interaction of both elements occurred solely after unserialize had finished its job. Consequently, it was not well suited to remote exploitation. After additional analysis, gaining a deeper understanding for the problem’s root causes and quite a lot of exhausting work an identical use-after-free vulnerability was discovered that appeared to be promising for distant exploitation. The excessive sophistication of the discovered PHP bugs and their discovery made it vital to put in writing separate articles. You can learn more particulars in Dario’s fuzzing unserialize write-up. As well as, we've got written an article about Breaking PHP’s Garbage Collection and Unserialize. Even this promising use-after-free vulnerability was significantly tough to exploit. In particular, it concerned multiple exploitation stages. 1. The stack and heap (which also include 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 wish to execute i.e. you have to have a valid deal with of an executable reminiscence section.
댓글목록
등록된 댓글이 없습니다.