A explanation and subsequent exploitation of eLection 2.0’s SQL injection vulnerability (CVE-2020–9340).
The eLection 2.0 application has an SQL injection vulnerability in the 'id' parameter of an admin AJAX endpoint. An authenticated attacker can exploit this to execute arbitrary commands on the server via SQLmap's os-shell feature.
medium.com
Published on medium.com
fauzantrif eLection 2.0 has SQL Injection via the admin/ajax/opkandidat.php id parameter.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application directly concatenates the 'id' parameter into an SQL query without sanitisation or parameterisation.
Impact
An authenticated attacker could execute arbitrary commands on the server, leading to full compromise.
What the attacker needed
Valid admin credentials; network access to the application
The fix
The application should sanitise all input parameters and use parameterised queries to prevent SQL injection.
How it was found
- Log in to the eLection admin panel.
- Navigate to the Candidates section and add a candidate.
- Intercept the request when clicking the edit user button.
- Save the intercepted request to a file.
- Send the request to Repeater and modify the 'id' parameter to test for SQL injection.
- Run SQLmap with the saved request file and the os-shell option to obtain remote command execution.
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 write-up has not been written yet. The Original tab links to the source.
SQL injection is a flaw where user input is inserted into database commands without proper handling, letting an attacker change the command's meaning. Here, a logged-in admin can manipulate the 'id' parameter to run database queries that eventually let them run system commands 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.