Skip to content
SQL injection Write-up Intermediate

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.

Hayden Kehn, on medium.com

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

  1. Log in to the eLection admin panel.
  2. Navigate to the Candidates section and add a candidate.
  3. Intercept the request when clicking the edit user button.
  4. Save the intercepted request to a file.
  5. Send the request to Repeater and modify the 'id' parameter to test for SQL injection.
  6. 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.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.