text stringlengths 0 1.99k |
|---|
webzine I absolutely loved was "PHP Codz Hacking," published by 80vul |
[14]. Though I couldn't fully grasp all the details at the time, I still |
kept reading whenever there was an update. These were all like spiritual |
food during my youth, shaping the younger me! |
As the CTF scene rapidly grew around the mid-2010s, it gradually became a |
significant contributor to PHP security. Whether it was organizers |
crafting ingenious challenges to test hackers worldwide, or teams coming |
up with unexpected solutions, all of these efforts have pushed PHP |
security forward. Just like I mentioned earlier, though CTF is essentially |
a mirror of the internet, sometimes it has real-world impacts, too! |
Fast forward to recent years, thanks to CTF, I've had the chance to |
witness - and even help create - several new attack techniques. Along the |
way, I've also revisited PHP's source code more times than I can count. I |
know there must be others who could talk about this better than me, but |
anyway, please let me take this special opportunity to fulfill one of my |
lifelong dreams! |
--[ Main |
Next up, I'd like to talk about the sparks that fly between CTF and PHP! |
Whether it's those classic techniques that have inspired generations of |
CTF authors, or how the CTF community pushes the security boundary in its |
unique way, I'd love to highlight those stories. |
Of course, no one can know every story out there. So, if anything's |
missing or inaccurately mentioned, I apologize in advance. Also, I'd love |
to hear more stories from you - I mean, the more we share these tales, the |
longer they'll live on :) |
----[ 1. Reviving Forgotten Bugs Through CTF |
We always want to stay at the cutting edge, but it's impossible to keep an |
eye on every single detail out there. That's exactly why CTF is such a |
perfect way to revisit those forgotten bugs. |
In fact, to create truly awesome challenges, many CTF authors even become |
"bug archaeologists." I mean, figuring out what's really fun seriously |
tests how broad our knowledge is and whether you're up-to-date with the |
latest techniques. That's why CTF authors usually go treasure hunting |
through obscure technical docs, forgotten forums, and even ancient bug |
trackers - digging out minor issues, unleashing their creativity, and |
breathing new life into them! |
Just take the "Corrupting Upload File Indices" bug [15], for example - |
it's something I'd completely overlooked for ages. It cleverly exploits |
the inconsistent use of `snprintf()` when building array index names, |
allowing you to craft data structures that normally require multiple file |
uploads - by using just the single-upload mode! It wasn't until I came |
across this trick during a quick onsite CTF that I realized I'd totally |
missed out on such a cool bug! |
------[ 1.1 - Formatting Objects for Fun and Profit! |
Since this is the first chapter, let me kick things off by sharing |
something from my own collection! Ever since the "Arbitrary Object |
Instantiation" first appeared in 2015 [16], I've been closely following |
this type of attack. Simply put, this attack is all about exploring what |
can go wrong when attackers control exactly which object gets instantiated |
by the `new` keyword. |
From past experiences messing around with Object Injection, we already |
know that the available classes in the environment pretty much decide |
whether an attack will succeed. Over the years, lots of researchers have |
dived into this topic and significantly advanced the exploitation |
techniques [17]. But if there aren't any vulnerable classes left in the |
environment - does that mean game over? Of course not! If you stop |
limiting yourself to "simply instantiating PHP objects," and instead take |
things down to a low-level language like C, you might even discover an |
entirely new way to break things open! |
-----------------[ Arbitrary Objects? Choose Your Weapon! ]---------------- |
<?php |
$model = $_GET['model']; |
$object = new $model(); |
--------------------------------------------------------------------------- |
I think the bug Andrew discovered [18] is an excellent example! This was a |
format-string vulnerability that popped up briefly in PHP 7.0.0. When PHP |
was making the big jump from 5.6 to 7.0, it introduced a brand-new |
`Throwable` interface to better catch errors that the old exception |
mechanism couldn't handle. However, while integrating the existing |
exception-handling logic into this new interface, the developers |
accidentally brought along this vulnerability, too. |
+--------------------------+ +--------------------------+ |
| Arbitrary Object Inst. | | PHP Bug #71105 | |
|--------------------------| |--------------------------| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.