Skip to content
This repository has been archived by the owner on Mar 2, 2019. It is now read-only.

Captcha Bypass Vulnerability in /admin/loginc.php #23

Closed
viccon opened this issue May 10, 2017 · 1 comment
Closed

Captcha Bypass Vulnerability in /admin/loginc.php #23

viccon opened this issue May 10, 2017 · 1 comment

Comments

@viccon
Copy link

viccon commented May 10, 2017

/admin/loginc.php

include '../config.php';
if (!session_id()) {
    session_start();
}
$res = $db->select('setting', array('name' => 'admin'));
if ($_POST['password'] == $res[0]['value'] && strtolower($_POST['captcha']) == strtolower($_SESSION['captcha']['code'])) {
    $_SESSION['alogin'] = true;
    header('Location: index.php');
} else {
    header('Location: login.php?err=1');
}

Note that $_SESSION['captcha']['code'] is set in /captcha/simple-php-captcha.php.
To bypass the captcha verification, we simply need to empty the $_POST['captcha'], but be sure there is no previous request to /captcha/simple-php-captcha.php.

How to fix:

- if ($_POST['password'] == $res[0]['value'] && strtolower($_POST['captcha']) == strtolower($_SESSION['captcha']['code'])) {
+ if ($_POST['password'] == $res[0]['value'] && isset($_SESSION['captcha']['code']) && strtolower($_POST['captcha']) == strtolower($_SESSION['captcha']['code'])) {
@s3131212
Copy link
Owner

Fixed in 255b44c

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants