Last active
February 7, 2019 17:18
-
-
Save willitscale/7f491e3901f583b00913ef176023da3a to your computer and use it in GitHub Desktop.
Deadly Bug
This file contains 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
<?php | |
if (empty($_POST['hmac']) || empty($_POST['host'])) { | |
header('HTTP/1.0 400 Bad Request'); | |
exit; | |
} | |
$secret = '123'; | |
if (!empty($_POST['nonce'])) { | |
$secret = hash_hmac('sha256', $_POST['nonce'], $secret); | |
} | |
$hmac = hash_hmac('sha256', $_POST['host'], $secret); | |
if ($hmac !== $_POST['hmac']) { | |
header('HTTP/1.0 403 Forbidden'); | |
exit; | |
} | |
echo exec('host ' . $_POST['host']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment