first commit
This commit is contained in:
parent
985a5c928c
commit
f40a84879c
551 changed files with 72374 additions and 24 deletions
75
dvwa/vulnerabilities/captcha/source/low.php
Normal file
75
dvwa/vulnerabilities/captcha/source/low.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
if( isset( $_POST[ 'Change' ] ) && ( $_POST[ 'step' ] == '1' ) ) {
|
||||
// Hide the CAPTCHA form
|
||||
$hide_form = true;
|
||||
|
||||
// Get input
|
||||
$pass_new = $_POST[ 'password_new' ];
|
||||
$pass_conf = $_POST[ 'password_conf' ];
|
||||
|
||||
// Check CAPTCHA from 3rd party
|
||||
$resp = recaptcha_check_answer( $_DVWA[ 'recaptcha_private_key' ],
|
||||
$_SERVER[ 'REMOTE_ADDR' ],
|
||||
$_POST[ 'recaptcha_challenge_field' ],
|
||||
$_POST[ 'recaptcha_response_field' ] );
|
||||
|
||||
// Did the CAPTCHA fail?
|
||||
if( !$resp->is_valid ) {
|
||||
// What happens when the CAPTCHA was entered incorrectly
|
||||
$html .= "<pre><br />The CAPTCHA was incorrect. Please try again.</pre>";
|
||||
$hide_form = false;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// CAPTCHA was correct. Do both new passwords match?
|
||||
if( $pass_new == $pass_conf ) {
|
||||
// Show next stage for the user
|
||||
$html .= "
|
||||
<pre><br />You passed the CAPTCHA! Click the button to confirm your changes.<br /></pre>
|
||||
<form action=\"#\" method=\"POST\">
|
||||
<input type=\"hidden\" name=\"step\" value=\"2\" />
|
||||
<input type=\"hidden\" name=\"password_new\" value=\"{$pass_new}\" />
|
||||
<input type=\"hidden\" name=\"password_conf\" value=\"{$pass_conf}\" />
|
||||
<input type=\"submit\" name=\"Change\" value=\"Change\" />
|
||||
</form>";
|
||||
}
|
||||
else {
|
||||
// Both new passwords do not match.
|
||||
$html .= "<pre>Both passwords must match.</pre>";
|
||||
$hide_form = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( isset( $_POST[ 'Change' ] ) && ( $_POST[ 'step' ] == '2' ) ) {
|
||||
// Hide the CAPTCHA form
|
||||
$hide_form = true;
|
||||
|
||||
// Get input
|
||||
$pass_new = $_POST[ 'password_new' ];
|
||||
$pass_conf = $_POST[ 'password_conf' ];
|
||||
|
||||
// Check to see if both password match
|
||||
if( $pass_new == $pass_conf ) {
|
||||
// They do!
|
||||
$pass_new = mysql_real_escape_string( $pass_new );
|
||||
$pass_new = md5( $pass_new );
|
||||
|
||||
// Update database
|
||||
$insert = "UPDATE `users` SET password = '$pass_new' WHERE user = '" . dvwaCurrentUser() . "';";
|
||||
$result = mysql_query( $insert ) or die( '<pre>' . mysql_error() . '</pre>' );
|
||||
|
||||
// Feedback for the end user
|
||||
$html .= "<pre>Password Changed.</pre>";
|
||||
}
|
||||
else {
|
||||
// Issue with the passwords matching
|
||||
$html .= "<pre>Passwords did not match.</pre>";
|
||||
$hide_form = false;
|
||||
}
|
||||
|
||||
mysql_close();
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue