Skip to content
SQL injection Write-up Intermediate

My write-up in hacking IBM’s administration panel and getting SQLi on it

An administration panel exposed a client_id parameter that allowed listing, adding, editing and deleting users without proper authorisation, and the same parameter was vulnerable to SQL injection, letting the attacker dump the whole database.

Momen Ali Follow

Published on cyberguy0xd1.medium.com

Welcome to my new write-up in my Bug Hunting Journey, today’s write-up will be unique, because here I’ll show you how i was able to takeover the administration panel of IBM and escalating this to SQL Injection, so let’s start.

Momen Ali (Cyber Guy), on cyberguy0xd1.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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 7 min read.

Context

This is a write-up from a bug hunting journey against IBM corporate infrastructure. The researcher found an administration panel on an IBM-owned host and escalated a Broken Access Control issue into SQL injection. The report covers Shodan reconnaissance, a methodology for achieving Broken Access Control, an impact escalation guide, SQL injection basics and SQL injection in Java-based applications.

The target was an IBM host discovered through Shodan, running HTTP on port 80 and HTTPS on port 443. The sensitive endpoint that led to the panel cannot be named because of IBM policy. The application is Java-based, and the panel exposed a user list and, once a client_id parameter was supplied, the ability to add, edit and delete users.

Setup

Tools used across the report:

  • Shodan, for finding IBM-owned hosts.
  • A browser or SSLShopper, to read the organisation name from the SSL certificate.
  • Wappalyzer, to fingerprint the technology of the web application.
  • arjun, for parameter fuzzing.
  • Burp Intruder, for enumerating the client_id parameter.
  • SQLMap, for dumping the database.

No accounts or roles are described beyond the panel's own user management. The application was under development, which matters later: a client_id already used by another client produces an error message.

Finding it

The starting point was Shodan. To filter results, the researcher first needed the organisation name in IBM's SSL certificate. This can be read manually from the certificate in the browser, or with a web-based tool such as SSLShopper. The organisation name is International Business Machines Corporation.

With that, a free Shodan dork was run, without restricting to a specific domain or IP:

Text
ssl:"International Business Machines Corporation"

Surfing the results led to the target host. To confirm the host belongs to IBM, the SSL certificate of the IP address was inspected manually, and the organisation name again showed IBM Corporation. Shodan listed ports 80 (HTTP) and 443 (HTTPS).

Entering the host in a browser showed a default server page. The researcher argues that default pages are worth testing, for three reasons:

  1. Server functions that contain logs may still be enabled because the developer has not disabled them, for example /server-status/. The report estimates that in 80% to 90% of cases such a server is new.
  2. Developers often keep under-development projects there, which may contain hard-coded credentials, leaked secrets or insecure functions.
  3. Such pages expose versions, so they can be checked against known CVEs.

Directory fuzzing was then used to map the application until a sensitive endpoint was found. The endpoint name cannot be disclosed because of IBM policy. Entering it revealed the administration panel. Wappalyzer was used to identify the technology, which showed the application works with Java.

At this point the panel only allowed listing all users in the system, which the researcher judged as not critical. Parameter fuzzing with arjun found a parameter named client_id. Supplying an id to this parameter produced three functionalities:

  • Adding a user
  • Editing the user
  • Deleting the user

Exploitation

Step 1: prove Broken Access Control by adding a user

The researcher added himself as a user to produce a proof of concept for the Broken Access Control. A trick applies here: because the application was under development, supplying a client_id already used by another client returns an error message. To get a successful proof of concept, the client_id was enumerated with Burp Intruder against the users list page until a user not found error matched, and that id was then assigned to the new user.

Step 2: reason about the back-end query

Since the application is Java-based, the researcher assumed the SQL parsed in the back end looked like a direct concatenation of the parameter. The payload tried was:

Text
1'/**/or/**/1=1;--

The goal was to dump all clients from the database. The report explains the mechanism with a normal query first:

SQL
SELECT uname FROM users WHERE client_id = 1;

This tells the SQL interpreter to select the username stored in the database, but only return it if client_id equals, for example, the number one.

The Java source is described as follows:

Java
String uid = request.getParameter("client_id");String query = "SELECT uname FROM users WHERE client_id = " + uid;

The first line creates a GET-based request parameter named client_id, so a request to retrieve one's own information looks like example.com/index.jsp?client_id=1. The second line parses the parameter into an SQL query, so any string typed in the parameter is parsed directly by the SQL DBMS. With client_id=1, the executed query is SELECT uname FROM users WHERE client_id = 1.

The report then explains why 1' or 1=1;-- works: 1=1 is a true boolean because the integer 1 equals the integer 1, whereas 1=2 is false. With the payload:

Text
1' or 1=1;--

the database is told to return the information of the client whose client_id is 1, or true, and true here means all client ids that exist in the database, so all clients' information is retrieved. The query worked and returned the whole user information in the database.

Step 3: dump the database with SQLMap

Rather than enumerating and trying many SQL payloads by hand, the researcher used SQLMap with the following command:

Bash
sqlmap -u "https://example.com/vuln.jsp?client_id=1" --dbs --hostname --current-user --risk=3 --level=5 --random-agent

The options, as explained in the report:

  • -u specifies the URL.
  • --dbs dumps the existing databases.
  • --hostname retrieves the server's hostname.
  • --current-user extracts the current DBMS user.
  • --risk allows the whole range of payload types in SQLMap to run; the report gives the default as 1.
  • --level specifies the number of checks SQLMap performs; the report gives the default as 5.
  • --random-agent randomises the user agent from SQLMap's list, because SQLMap otherwise uses a user agent such as:
Text
sqlmap/1.3.11#stable (http://sqlmap.org)

which may be caught by firewalls or detected by blue teams.

The database was dumped and the report was resolved.

Root cause

The access control flaw is that supplying a client_id value unlocks the add, edit and delete functions for that client. Supplying any valid id grants the add, edit and delete functions for that client. The only obstacle was that ids already in use returned an error, which enumeration solved.

The SQL injection is caused by string concatenation of the client_id request parameter into the query, as shown in the Java snippet: the parameter value is appended directly to the SQL text and parsed by the DBMS. No parameterised query or escaping is described. The report does not describe any server-side defence that stopped or slowed the attack.

Impact

With the Broken Access Control, an attacker who reaches the panel can list all users in the system and, by choosing a valid client_id, is offered the add, edit and delete functions for that client. With the SQL injection, the attacker can retrieve the information of all clients in the database, and SQLMap was used to dump the databases, the server hostname and the current DBMS user. The researcher describes this as taking over the administration panel and escalating it to SQL injection. The report does not state a bounty amount or a CVSS score.

Fix

Based on the described cause, the access control should bind client_id to the authenticated user's own client rather than accepting it from the request, and the query should use a parameterised statement instead of concatenating the parameter into the SQL string.

Variants to test

  • Shodan dorking on the certificate organisation name: a positive result is a set of hosts whose SSL certificate names the target organisation, which can then be checked for default pages and forgotten endpoints.
  • Directory fuzzing on hosts with default pages: a positive result is a sensitive endpoint that exposes a panel or data, as happened here.
  • Parameter fuzzing with arjun on panel endpoints: a positive result is a hidden parameter such as client_id that changes the available functionality.
  • Supplying another client's id to an object reference: a positive result is access to that client's users or data, or add, edit and delete actions on them.
  • Enumerating ids with Burp Intruder when used ids return errors: a positive result is an unused id that the application accepts, which can then be assigned.
  • Injecting a boolean payload such as 1'/**/or/**/1=1;-- into an id parameter of a Java application: a positive result is the full list of records instead of a single one.
  • Running SQLMap with --dbs --hostname --current-user --risk=3 --level=5 --random-agent against a confirmed injection point: a positive result is the database list, hostname and current DBMS user being returned.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 16 min read.

What happened, in plain words

A security researcher was hunting for bugs in IBM's systems. He used a search engine called Shodan, which is like Google but for internet-connected machines rather than web pages, to find computers that belong to IBM. One of those computers showed a boring default page, the kind of page a web server shows when nobody has set up a real website on it yet. Most people would close the tab and move on. He did not.

He poked around that server with a technique called directory fuzzing, which means trying lots of possible folder and file names to see which ones exist. That led him to a hidden administration panel, a private page where someone manages users. At first the panel only let him see a list of all the users in the system. That is already a problem, but not a dramatic one.

Then he found a hidden setting called client_id. When he gave it a value, the panel suddenly offered him buttons to add, edit and delete users. He was able to add himself as a user, which proved he could do things he should not be allowed to do. This kind of flaw is called Broken Access Control: the application does not properly check whether you are allowed to do something.

Finally, he noticed the application was built with the programming language Java, and he guessed that the client_id value was being pasted straight into a database question (a SQL query). He sent a specially crafted value, and the database answered with information about every client instead of just one. That is SQL injection. He then used a tool called SQLMap to pull out the databases, the server's hostname and the database user, and the report was resolved.

This article walks through each step slowly, explaining every term as it appears.

The tools he used

Before the story, here is the kit. You do not need to install anything to follow along; this is just so the names are not mysterious later.

  • Shodan: a search engine that indexes servers, routers, webcams and other machines connected to the internet. You search it with filters, a bit like searching a catalogue.
  • A browser, or a website called SSLShopper: used to read the organisation name written inside a website's security certificate (explained below).
  • Wappalyzer: a browser extension that looks at a website and guesses what technology built it, for example Java, PHP or WordPress.
  • arjun: a command-line tool that tries many possible parameter names against a URL to discover hidden ones.
  • Burp Intruder: a feature of the Burp Suite tool that sends the same request many times with one part changed each time, which is useful for trying every number in a range.
  • SQLMap: a command-line tool that automates finding and exploiting SQL injection.

No user accounts or permission levels are described in the report beyond the panel's own user management. One detail matters later: the application was still under development, so if you supplied a client_id that another client was already using, the application returned an error message.

Finding the target

Step 1: learn IBM's organisation name from its certificate

When you visit a website over HTTPS (the padlock in your browser), the server presents a certificate. Think of it as a passport: it proves the site is who it claims to be, and it contains details such as the organisation the certificate was issued to. Shodan can search on that field, so the researcher first needed to know exactly what IBM's certificate says.

You can read it yourself: click the padlock in your browser, open the certificate details, and look for the organisation field. Or you can paste the domain into a free web tool such as SSLShopper, which shows the same information in a readable form.

The organisation name turned out to be International Business Machines Corporation. That exact string is what Shodan needs.

Why bother? Because Shodan scans an enormous number of machines every day. If you search for something vague you get thousands of irrelevant results and waste hours. Filtering by the certificate's organisation name narrows the list to machines that actually belong to the company you care about.

Step 2: search Shodan with that name

The researcher ran a free Shodan search, without limiting it to a particular domain or IP address, using this query:

Text
ssl:"International Business Machines Corporation"

Line by line:

  • ssl: tells Shodan to look inside the SSL/TLS certificate of each machine, not in the page content.
  • The quoted text is the exact organisation name found in step 1. The quotes keep it as one phrase, so Shodan does not split it into separate words.

Scrolling through the results, he found a host that looked interesting.

Step 3: confirm the host really belongs to IBM

A search result is not proof. Anyone can put a company name in a certificate, and Shodan results can be stale. So he inspected the SSL certificate of that specific IP address by hand, and the organisation name again showed IBM Corporation. That was his evidence.

Shodan also listed which ports were open on the machine:

  • Port 80, which is plain HTTP, the unencrypted version of the web.
  • Port 443, which is HTTPS, the encrypted version.

A port is like a numbered door on a building. A server has many doors, and each service listens on a particular one. Ports 80 and 443 being open simply means a web server is running there.

Step 4: look at the page and do not walk away

Opening the host in a browser showed a default server page. This is the page a web server shows when no real site has been configured yet, similar to the blank welcome screen on a brand-new phone.

Most people would close the tab. The researcher argues that default pages are worth testing, for three reasons:

  1. Some server features that produce logs may still be switched on because the developer never turned them off, for example /server-status/. The report estimates that in 80% to 90% of cases such a server is new.
  2. Developers often leave unfinished projects on the same server, and those can contain hard-coded credentials (a username and password typed directly into the code), leaked secrets, or insecure functions.
  3. Such pages often reveal version numbers, so you can check whether the software has a known CVE, which is a publicly catalogued security flaw with an ID number.

Step 5: map the application with directory fuzzing

Directory fuzzing means taking a list of common folder and file names and asking the server for each one, watching which ones answer differently. It is like trying every door in a corridor to see which ones open.

This led him to a sensitive endpoint. An endpoint is simply a specific address on a server that does something, for example a page that shows a list or accepts a form. The report cannot name this endpoint because of IBM's disclosure policy.

Visiting it revealed the administration panel.

Step 6: identify the technology

Before testing, he wanted to know what the application was built with. He used the Wappalyzer browser extension, which inspects clues in the page and its responses and reports likely technologies. It showed the application works with Java.

This matters later: knowing the language helps you guess how the code is written and therefore what kind of mistake to look for.

Step 7: find the hidden parameter

At this point the panel only let him list all the users in the system. He judged that as not critical on its own. Seeing a list is bad, but changing things is worse.

He ran parameter fuzzing with arjun. A parameter is a named value you attach to a URL, usually after a question mark, like ?colour=blue. Many applications accept parameters that are not linked anywhere in the visible page, so you have to guess their names. arjun tries a long list of common names and reports which ones the server reacts to.

It found a parameter named client_id. When he supplied an id to it, three new functions appeared:

  • Adding a user
  • Editing the user
  • Deleting the user

In other words, a single hidden value unlocked the whole management interface.

Exploitation

Step 1: prove Broken Access Control by adding a user

Broken Access Control means the application does not properly check whether you are allowed to perform an action. A simple comparison: a hotel key card that opens every room because the door only checks that the card is valid, not which room it belongs to.

To prove the flaw, the researcher added himself as a user. That is the proof of concept: a small, safe demonstration that the problem is real.

There was a catch. Because the application was under development, supplying a client_id that another client was already using returned an error message. So he needed an id that was not in use.

His solution was enumeration: trying values one after another and watching the responses. He used Burp Intruder against the users list page, cycling through ids until he hit a user not found error, which told him that particular id was free. He then assigned that id to his new user.

Enumeration is like trying seat numbers in a cinema booking system until you find one that is not taken.

Step 2: guess the database query behind the parameter

Since the application is Java-based, the researcher assumed the SQL query in the back end was built by gluing the parameter value directly onto the query text. SQL is the language used to talk to a database; a query is a question you ask it, such as "give me the usernames".

He tried this payload:

Text
1'/**/or/**/1=1;--

A payload is the crafted input you send to trigger a bug. The goal was to dump all clients from the database, meaning to retrieve every client's records.

Before explaining the payload, the report shows what a normal query looks like:

SQL
SELECT uname FROM users WHERE client_id = 1;

Line by line:

  • SELECT uname means "give me the values in the column called uname", which presumably holds usernames.
  • FROM users says the data lives in the table called users. A table is like a spreadsheet with rows and columns.
  • WHERE client_id = 1 is a filter: only return rows where the client_id column equals the number one.
  • The semicolon ends the statement.

So this query returns the usernames of the client whose id is 1, and nothing else.

The Java code behind it is described as follows:

Java
String uid = request.getParameter("client_id");String query = "SELECT uname FROM users WHERE client_id = " + uid;

Line by line:

  • String uid = request.getParameter("client_id"); reads the value of the client_id parameter from the incoming request and stores it in a variable called uid. Because the parameter arrives in the URL, this is a GET-based request parameter. A GET request is the ordinary kind your browser makes when you type an address or click a link.
  • String query = "SELECT uname FROM users WHERE client_id = " + uid; builds the query text by taking the fixed string and adding the value of uid onto the end with +. This is called string concatenation, and it is the root of the problem: whatever the user typed becomes part of the SQL.

So a request to retrieve your own information looks like example.com/index.jsp?client_id=1. The .jsp ending is a Java server page. With client_id=1, the executed query is SELECT uname FROM users WHERE client_id = 1.

Now the payload. The report explains why 1' or 1=1;-- works by starting with boolean logic: 1=1 is true because the integer 1 equals the integer 1, while 1=2 is false because 1 does not equal 2. A boolean is simply a value that is either true or false.

With the payload:

Text
1' or 1=1;--

Here is what each part does when it is glued into the query:

  • 1 is the ordinary value, so the query starts as client_id = 1.
  • ' is a single quote. In SQL, text values are wrapped in quotes, so this closes whatever quoting the query had and lets the rest be read as SQL code rather than data.
  • or 1=1 adds a condition that is always true. Since the query now says "client_id equals 1, or true", every row matches.
  • ; ends the statement.
  • -- starts a comment in SQL, so anything after it is ignored. This is useful to discard the rest of the original query, which might otherwise cause a syntax error.

The report also shows the payload with /**/ between the words:

Text
1'/**/or/**/1=1;--

In plain words: the database was told to return the information of the client whose client_id is 1, or true, and true here means all client ids that exist in the database. So all clients' information was retrieved.

The query worked and returned the whole user information in the database.

Step 3: dump the database with SQLMap

Rather than enumerating and trying many SQL payloads by hand, the researcher used SQLMap. Doing it manually is like picking a lock one pin at a time; SQLMap is the power tool that tries many approaches automatically.

He ran:

Bash
sqlmap -u "https://example.com/vuln.jsp?client_id=1" --dbs --hostname --current-user --risk=3 --level=5 --random-agent

Line by line, as explained in the report:

  • -u specifies the URL to test. The URL in the example is a placeholder; the real one is not published.
  • --dbs dumps the list of existing databases. A database server usually holds several databases, like folders on a drive.
  • --hostname retrieves the server's hostname, the name the machine calls itself on the network.
  • --current-user extracts the current DBMS user, meaning the account the web application uses to talk to the database. DBMS stands for database management system, the software that stores and answers queries.
  • --risk allows the whole range of payload types in SQLMap to run. The report gives the default as 1; higher values try more aggressive payloads that carry more risk of breaking something.
  • --level specifies the number of checks SQLMap performs. The report gives the default as 5; higher values test more places and combinations.
  • --random-agent randomises the user agent from SQLMap's list. The user agent is a short line your browser or tool sends to identify itself, for example "I am Chrome on Windows". SQLMap normally sends a user agent such as:
Text
sqlmap/1.3.11#stable (http://sqlmap.org)

That line is a giveaway. Firewalls can block it and blue teams, the defenders who monitor a network, can spot it in their logs. Randomising it makes the traffic look less obviously automated.

The database was dumped and the report was resolved.

Why it worked

The access control flaw is that supplying a client_id value unlocks the add, edit and delete functions for that client. Supplying any valid id grants the add, edit and delete functions for that client. The only obstacle was that ids already in use returned an error, and enumeration solved that.

The SQL injection is caused by string concatenation of the client_id request parameter into the query, as the Java snippet shows: the parameter value is appended directly to the SQL text and parsed by the database. No parameterised query or escaping is described. The report does not describe any server-side defence that stopped or slowed the attack.

What an attacker could do

With the Broken Access Control, anyone who reaches the panel can list all users in the system and, by choosing a valid client_id, is offered the add, edit and delete functions for that client. With the SQL injection, the attacker can retrieve the information of all clients in the database, and SQLMap was used to dump the databases, the server hostname and the current DBMS user. The researcher describes this as taking over the administration panel and escalating it to SQL injection. The report does not state a bounty amount or a CVSS score.

How it should be fixed

Based on the described cause, the access control should bind client_id to the authenticated user's own client rather than accepting it from the request, and the query should use a parameterised statement instead of concatenating the parameter into the SQL string. A parameterised statement keeps the user's input separate from the query text, so it can never be read as code.

Things worth trying on your own targets

These are patterns to look for, not instructions to attack anything you do not own or have permission to test.

  • Shodan dorking on the certificate organisation name: a positive result is a set of hosts whose SSL certificate names the target organisation, which can then be checked for default pages and forgotten endpoints.
  • Directory fuzzing on hosts with default pages: a positive result is a sensitive endpoint that exposes a panel or data, as happened here.
  • Parameter fuzzing with arjun on panel endpoints: a positive result is a hidden parameter such as client_id that changes the available functionality.
  • Supplying another client's id to an object reference: a positive result is access to that client's users or data, or add, edit and delete actions on them.
  • Enumerating ids with Burp Intruder when used ids return errors: a positive result is an unused id that the application accepts, which can then be assigned.
  • Injecting a boolean payload such as 1'/**/or/**/1=1;-- into an id parameter of a Java application: a positive result is the full list of records instead of a single one.
  • Running SQLMap with --dbs --hostname --current-user --risk=3 --level=5 --random-agent against a confirmed injection point: a positive result is the database list, hostname and current DBMS user being returned.

Glossary

  • Access control: the rules that decide who is allowed to see or change what.
  • arjun: a command-line tool that discovers hidden URL parameters by trying many names.
  • Blue team: the defenders who monitor and protect a network.
  • Boolean: a value that is either true or false.
  • Broken Access Control: a flaw where the application does not properly check whether you are allowed to perform an action.
  • Burp Intruder: a Burp Suite feature that repeats a request many times with one part changed each time.
  • Certificate (SSL/TLS): a digital passport a website presents over HTTPS, containing details such as the organisation it was issued to.
  • Concatenation: joining two pieces of text end to end, here gluing user input onto a query.
  • CVE: a publicly catalogued security flaw with an ID number.
  • CVSS: a standard score for how severe a vulnerability is.
  • Database: software that stores data in tables and answers queries about it.
  • DBMS: database management system, the software that runs a database.
  • Default page: the page a web server shows when no real site has been configured yet.
  • Directory fuzzing: trying many common folder and file names to discover what exists on a server.
  • Dump: to retrieve and extract data from a database.
  • Endpoint: a specific address on a server that does something, such as a page or an API route.
  • Enumeration: trying values one after another and watching the responses to learn which are valid.
  • GET request: the ordinary kind of web request your browser makes when you type an address or click a link.
  • Hard-coded credentials: a username and password written directly into the source code.
  • Hostname: the name a machine uses for itself on a network.
  • HTTP / HTTPS: the protocol browsers use to fetch web pages; HTTPS is the encrypted version.
  • Java: a programming language often used for server-side web applications.
  • Parameter: a named value attached to a URL, usually after a question mark, such as ?colour=blue.
  • Parameterised statement: a database query where user input is kept separate from the query text, so it cannot be read as code.
  • Payload: the crafted input you send to trigger a vulnerability.
  • Port: a numbered door on a server that a particular service listens on, such as 80 for HTTP and 443 for HTTPS.
  • Proof of concept (PoC): a small, safe demonstration that a vulnerability is real.
  • Query: a question asked of a database, written in SQL.
  • Shodan: a search engine that indexes internet-connected machines.
  • SQL: the language used to talk to a database.
  • SQL injection: a flaw where user input is treated as part of a SQL query, letting an attacker change the query.
  • SQLMap: a tool that automates finding and exploiting SQL injection.
  • SSLShopper: a website that displays the details of a site's SSL certificate.
  • String: a piece of text in programming.
  • Table: a set of data in a database, arranged in rows and columns.
  • User agent: a short line a browser or tool sends to identify itself.
  • Wappalyzer: a browser extension that guesses which technologies a website uses.
  • client_id: the parameter found in this report that controlled which client's data and actions were available.

More by Momen Ali

View all

3 more disclosed reports, best first.

More from IBM

View all

The newest disclosed reports for this program.

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.