Skip to content
Account takeover Write-up Intermediate

This Is How a Hacker Hacks: Part 1 — Finding the Door

An e-document portal ran Joomla 1.5.0, whose password-reset flow trusts a user-supplied token without validating it. An unauthenticated attacker could reset the password of the first enabled user, usually the administrator, in two requests.

medium.com

Published on medium.com

Pentesting

CypherNova1337, 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.

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. 6 min read.

Context

This is the first part of a series drawn from an authorised penetration test against a large public university in Southeast Asia. The estate covered roughly 144 subdomains, of which 101 were alive, and the infrastructure spanned four decades of technology. Names, addresses, credentials and data were changed for publication; the techniques and CVE numbers are real.

The client's brief was to show what an attacker would do. By the end of the engagement the team had root on the document system, root on the backup server and a password to the central campus database. Part 1 covers reconnaissance and the first door: an 18-year-old CMS with a ten-line vulnerability in its password-reset flow.

The target is the e-document system, the university's official document-and-regulation portal, running Joomla. The vulnerable functionality is Joomla's user component password-reset flow.

Setup

No accounts were needed for the first step: the reset flow is reachable unauthenticated. The relevant preconditions are on the target side.

Reconnaissance produced the following estate profile:

Stack Where it ran
PHP 5.3 (EOL 2014) general office sites
PHP 5.5 / 5.6 (EOL 2016-2018) tracking, QA systems
PHP 7.1-7.4 faculty portals
PHP 8.x newer apps (audit, sport, e-passport)
IIS / ASP.NET the MIS portal (IIS 10) and a library system on IIS 7.5, the Windows 2008 era
WordPress 6.6 the agriculture faculty

Every faculty and office ran its own stack. Some boxes were patched that year; some had not been touched since 2014. The e-document system fingerprinted as:

Text
Joomla! 1.5.0

Not 1.5.26, not 1.7: 1.5.0, the very first release, from January 2008. Eighteen years old at the time of the test.

The engagement rules were "prove, don't change", which shaped how far the team went at each step.

Finding it

The spread of patch levels was the first working assumption: the estate is only as strong as its oldest member. The e-document system was that member. Its fingerprint gave the game away immediately, and a CVE lookup tied the version to a known flaw: Joomla 1.5.0 through 1.5.5 ship a password-reset flow that trusts a user-supplied token without checking it. The vulnerability is CVE-2008-3681. It lets an unauthenticated attacker reset the password of the first enabled user, which in a small organisation is usually the administrator.

From the original on medium.com

The image sits at the top of the article, under the title and byline.

Exploitation

The vulnerable flow, simplified, is two requests.

Step 1: confirm the reset state

The first endpoint accepts a POST containing a token consisting of a single quote:

HTTP
index.php?option=com_user&task=confirmreset

Because the token check is broken, the session now believes it holds a valid reset token, and it stores the ID of the first enabled user. The report describes the POST as containing token=', a single quote.

At this point the team stopped. The engagement rules said "prove, don't change", so they tested only the first step and watched the session reach the reset state without touching anything. That pause, confirming scope before pulling the trigger, is the difference between a pentest and a break-in.

Step 2: apply the new password

The second endpoint accepts a POST with a new password and applies it to that first enabled user:

HTTP
index.php?option=com_user&task=completereset

Two HTTP requests in total, and the administrator password is yours. The version check against the CVE gave the door; the actual POST exchange would have given the proof. The report says the reset is executed in Part 2, not here.

Root cause

The reset flow trusts a user-supplied token without validating it. In the affected Joomla versions, submitting a token of a single quote puts the session into the reset state and binds it to the first enabled user, so the follow-up request can set that user's password. The flaw is in the application logic, not in the transport, and it needs no authentication.

The public sites sat behind a reverse proxy with a WAF, whose rules the team mapped separately.

The WAF, and what it taught

The team's first interactions with the site mapped the WAF's ruleset the hard way:

  • PHP code in a POST body was blocked instantly. Any request whose body looked like <?php ... ?> died at the door. This mattered because the admin panel has a template editor, the classic edit-a-template-get-a-shell path, and the WAF made sure that path was not available in one step.
  • Long GET parameters were blocked. The command-and-control pattern of passing shell commands as base64 in a GET parameter had a size budget the team discovered empirically.
  • Binary multipart uploads passed. The WAF was inspecting text bodies; a ZIP file is not a text body.

That last observation became the entire upload strategy in Part 2. The meta-lesson: the WAF was not bypassed with an exotic technique. The team learned which shapes of traffic it inspected and which it did not, and used the gap. Most WAF bypasses are category errors on the defender's side.

What Part 1 proved

By the end of reconnaissance the team knew:

  • The exact vulnerable version and the exact reset flow, proven to the session-state step but not executed.
  • The WAF's three behaviours that would shape every later move.
  • That the admin account was the only account on the system, tied to a personal webmail address, itself a finding worth more than most CVEs.
  • That the estate's patch spread meant the document system was not an outlier; it was the floor.

The client approved the full chain the next day. Part 2 is the takeover itself: the reset executed, the admin panel, and the first shell through the WAF's blind spot.

Impact

An unauthenticated attacker who can reach the reset endpoints can take over the first enabled user, which in a small organisation is usually the administrator. On this system the admin account was the only account, tied to a personal webmail address. The report does not go further than that for Part 1; the escalation to root on the document system and the backup server, and the campus database password, came later in the chain.

Fix

The report does not describe a fix applied by the client. The broader point the author makes is that patch spread is a security control, and measuring it is reconnaissance: eighteen years of patches since 1.5.0 existed, and none of them mattered because nobody had applied them to this box.

Variants to test

  • Fingerprint old CMS releases on forgotten subdomains. A positive result is a version string in the page or headers that maps to a known CVE, as Joomla! 1.5.0 did here.
  • Exercise password-reset flows with malformed tokens. A positive result is the session entering the reset state, or being bound to a user, without a valid token.
  • Map WAF coverage by request shape. Send text bodies containing code, long GET parameters and binary multipart uploads separately; a positive result is a category the WAF passes untouched, as binary multipart uploads did here.
  • Check whether the first enabled user is the administrator, and whether that account is tied to an external address. A positive result is a single privileged account reachable through the reset flow.

Lesson from Part 1: the oldest member of the estate defines the estate.

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. 11 min read.

What happened, in plain words

A university in Southeast Asia hired a team of security testers to answer one question: "show us what an attacker would do." The university gave the team written permission to probe its systems, which is what makes this a penetration test (often shortened to pentest) rather than a crime. The difference is the permission, and the rules that come with it.

The team ended up with root on the university's document system, root on its backup server, and a password to its central campus database. This article is the first part of the story, and it only covers the beginning: how the team looked around, and how it found the first way in. That way in was a piece of web software that was eighteen years old, with a small mistake in the part that lets people reset a forgotten password.

Everything below is anonymised: names, addresses, credentials and data were changed. The techniques and the CVE numbers are real. A CVE number is a public catalogue number for a known security flaw, so anyone in the world can look it up and read about it.

From the original on medium.com

The image sits at the top of the article, under the title and byline.

The estate: 144 subdomains, 101 alive, four decades of tech

A subdomain is a name that sits in front of a main domain name. If the main domain is university.example, then library.university.example and sport.university.example are subdomains. Large organisations have many of them, one per department, service or old project, and they are often forgotten.

Reconnaissance (recon for short) is the looking-around phase. Before touching anything, you find out what exists. The team did three things, in this order:

  1. Enumerate subdomains. Find as many subdomain names as possible. This is like walking around a building and writing down every door you can see, including the ones at the back.
  2. Resolve them. Ask the internet's address system, the DNS, which of those names actually point to a live machine. A name can exist on paper and lead nowhere.
  3. Fingerprint what answers. Work out what software each live machine is running. A fingerprint is the set of clues a server gives away about itself, such as a version number in a page or in a response header.

The result was a table of old and new software sitting side by side:

Stack Where it ran
PHP 5.3 (EOL 2014) general office sites
PHP 5.5 / 5.6 (EOL 2016-2018) tracking, QA systems
PHP 7.1-7.4 faculty portals
PHP 8.x newer apps (audit, sport, e-passport)
IIS / ASP.NET the MIS portal (IIS 10) and a library system on IIS 7.5, the Windows 2008 era
WordPress 6.6 the agriculture faculty

PHP is a programming language used to build web pages. IIS is Microsoft's web server software, and ASP.NET is Microsoft's framework for building sites on it. WordPress is a popular system for building websites. EOL means "end of life": the maker has stopped releasing security fixes, so any flaw found later stays unfixed unless someone upgrades.

Every faculty and office ran its own stack. Some boxes were patched that year; some had not been touched since 2014. A patch is a small update that closes a known hole. This spread of patch levels is normal in big organisations, and it gives an attacker a simple working assumption: the estate is only as strong as its oldest member. You do not need to break the newest lock if an old one is still on the same corridor.

The old member here was the e-document system, the university's official portal for documents and regulations. Its fingerprint gave the game away immediately:

Text
Joomla! 1.5.0

Joomla is a CMS, a content management system: software that lets people publish and edit website pages without writing code. The line above is the version string the site revealed. Not 1.5.26, not 1.7: 1.5.0, the very first release, from January 2008. Eighteen years old at the time of the test.

A quick lookup in the CVE catalogue tied that version to a known flaw: Joomla 1.5.0 through 1.5.5 ship a password-reset flow that trusts a user-supplied token without checking it. The flaw is CVE-2008-3681. It lets someone who is not logged in at all reset the password of the first enabled user, which in a small organisation is usually the administrator.

The engagement rules were "prove, don't change". That phrase shaped how far the team went at every step: show that the door opens, but do not walk through it and start rearranging the furniture.

The door: a 10-line reset bug from 2008

To understand the flaw you need to know what a password reset normally does. You click "forgot my password", the site emails you a link containing a long random string, and that string is the token. A token is a temporary pass that proves you are the person who received the email. You send it back to the site, and the site checks it before letting you set a new password. The whole security of the flow rests on that check.

In the affected Joomla versions, the check is broken. The flow, simplified, is two requests. A request is one message your browser sends to a server, and a POST is a request that carries data in its body, the way a form submission does.

Step 1: confirm the reset state

The first endpoint accepts a POST containing a token consisting of a single quote:

HTTP
index.php?option=com_user&task=confirmreset

An endpoint is one specific address on a server that does one specific job. Read the line as an address plus instructions: index.php is the main script, option=com_user says "use the user component", and task=confirmreset says "run the confirm-reset task". A component in Joomla is a bundle of related features, and this one handles user accounts.

Because the token check is broken, the session now believes it holds a valid reset token, and it stores the ID of the first enabled user. A session is the server's short-term memory of your visit, so it can tell your second request apart from a stranger's. The report describes the POST as containing token=', a single quote.

At this point the team stopped. The engagement rules said "prove, don't change", so they tested only the first step and watched the session reach the reset state without touching anything. That pause, confirming scope before pulling the trigger, is the difference between a pentest and a break-in. The team had shown the door was unlocked without opening it.

Step 2: apply the new password

The second endpoint accepts a POST with a new password and applies it to that first enabled user:

HTTP
index.php?option=com_user&task=completereset

Same pattern: option=com_user selects the user component, and task=completereset runs the step that actually writes the new password. Two HTTP requests in total, and the administrator password is yours. HTTP is the language browsers and servers use to talk to each other.

The version check against the CVE gave the door; the actual POST exchange would have given the proof. The report says the reset is executed in Part 2, not here.

Why it worked

The reset flow trusts a user-supplied token without validating it. In the affected Joomla versions, submitting a token of a single quote puts the session into the reset state and binds it to the first enabled user, so the follow-up request can set that user's password. The flaw is in the application logic, not in the transport, and it needs no authentication. Authentication is proving who you are, with a password or similar. Here, nobody had to prove anything.

The public sites sat behind a reverse proxy with a WAF, whose rules the team mapped separately. A reverse proxy is a server that sits in front of the real site and passes traffic through. A WAF, a web application firewall, is a filter inside that proxy that inspects traffic and blocks what looks dangerous.

The WAF, and what it taught

The team's first interactions with the site mapped the WAF's ruleset the hard way. A ruleset is the list of patterns the filter blocks. Three findings came out of it:

  • PHP code in a POST body was blocked instantly. Any request whose body looked like <?php ... ?> died at the door. This mattered because the admin panel has a template editor, the classic edit-a-template-get-a-shell path, and the WAF made sure that path was not available in one step. A shell is a way to run commands on someone else's machine; a template is a page layout file the site lets an administrator edit.
  • Long GET parameters were blocked. A GET parameter is data stuck onto the end of a URL after a question mark, like the option= and task= parts above. The command-and-control pattern of passing shell commands as base64 in a GET parameter had a size budget the team discovered empirically. Base64 is a way of writing any data using plain letters and digits, and empirically means by trying and watching what happens.
  • Binary multipart uploads passed. The WAF was inspecting text bodies; a ZIP file is not a text body. A multipart upload is the standard way a browser sends a file to a server, and binary means raw bytes rather than readable text.

That last observation became the entire upload strategy in Part 2. The meta-lesson: the WAF was not bypassed with an exotic technique. The team learned which shapes of traffic it inspected and which it did not, and used the gap. Most WAF bypasses are category errors on the defender's side. In everyday terms: the guard was checking everyone carrying a suitcase and ignoring everyone carrying a box.

What Part 1 proved

By the end of reconnaissance the team knew:

  • The exact vulnerable version and the exact reset flow, proven to the session-state step but not executed.
  • The WAF's three behaviours that would shape every later move.
  • That the admin account was the only account on the system, tied to a personal webmail address, itself a finding worth more than most CVEs.
  • That the estate's patch spread meant the document system was not an outlier; it was the floor.

The client approved the full chain the next day. Part 2 is the takeover itself: the reset executed, the admin panel, and the first shell through the WAF's blind spot.

What it means for the university

Someone who is not logged in at all, but can reach the reset endpoints, can take over the first enabled user, which in a small organisation is usually the administrator. On this system the admin account was the only account, tied to a personal webmail address. The report does not go further than that for Part 1; the escalation to root on the document system and the backup server, and the campus database password, came later in the chain. Root is the highest level of control on a machine.

How it should be fixed

The report does not describe a fix applied by the client. The broader point the author makes is that patch spread is a security control, and measuring it is reconnaissance: eighteen years of patches since 1.5.0 existed, and none of them mattered because nobody had applied them to this box.

Things to try on your own systems

  • Fingerprint old CMS releases on forgotten subdomains. A positive result is a version string in the page or headers that maps to a known CVE, as Joomla! 1.5.0 did here.
  • Exercise password-reset flows with malformed tokens. A positive result is the session entering the reset state, or being bound to a user, without a valid token.
  • Map WAF coverage by request shape. Send text bodies containing code, long GET parameters and binary multipart uploads separately; a positive result is a category the WAF passes untouched, as binary multipart uploads did here.
  • Check whether the first enabled user is the administrator, and whether that account is tied to an external address. A positive result is a single privileged account reachable through the reset flow.

Lesson from Part 1: the oldest member of the estate defines the estate.

Glossary

  • Authentication: proving who you are, usually with a password or similar.
  • Base64: a way of writing any data using plain letters and digits.
  • Binary: raw bytes rather than readable text.
  • CMS (content management system): software that lets people publish and edit website pages without writing code.
  • Component: in Joomla, a bundle of related features, such as user accounts.
  • CVE number: a public catalogue number for a known security flaw.
  • DNS: the internet's address system, which turns names into the addresses of live machines.
  • Endpoint: one specific address on a server that does one specific job.
  • EOL (end of life): the maker has stopped releasing security fixes for that software.
  • Fingerprint: the clues a server gives away about what software and version it runs.
  • GET parameter: data stuck onto the end of a URL after a question mark.
  • HTTP: the language browsers and servers use to talk to each other.
  • IIS: Microsoft's web server software.
  • Joomla: a content management system used to build websites.
  • Multipart upload: the standard way a browser sends a file to a server.
  • Patch: a small update that closes a known security hole.
  • Penetration test (pentest): probing systems with written permission, to find weaknesses before an attacker does.
  • PHP: a programming language used to build web pages.
  • POST: a request that carries data in its body, the way a form submission does.
  • Reconnaissance (recon): the looking-around phase, finding out what exists before touching anything.
  • Request: one message your browser sends to a server.
  • Reverse proxy: a server that sits in front of the real site and passes traffic through.
  • Root: the highest level of control on a machine.
  • Ruleset: the list of patterns a filter blocks.
  • Session: the server's short-term memory of your visit, so it can tell your requests apart from a stranger's.
  • Shell: a way to run commands on someone else's machine.
  • Subdomain: a name in front of a main domain name, such as library.university.example.
  • Template: a page layout file that a site lets an administrator edit.
  • Token: a temporary pass, such as the random string in a password-reset link, that proves you received it.
  • WAF (web application firewall): a filter that inspects traffic and blocks what looks dangerous.
  • WordPress: a popular system for building websites.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.