Skip to content
Access control Write-up Intermediate

From Guest to Root: Complete JWT + SSH + Pcap + Log Analysis

The web application accepted a JWT with the algorithm set to none and an admin role, letting a guest escalate to admin. Admin access exposed a phpinfo page that leaked SSH credentials, which gave a shell and led to further files and a final flag.

Vedant Kumbhar Follow

Published on medium.com

A complete step-by-step documentation of a multi-stage cybersecurity challenge involving JWT attacks, information disclosure, SSH access, packet analysis, and log forensics.

Vedant Kumbhar, 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. 7 min read.

Context

This is a write-up of a multi-stage capstone challenge rather than a single bug bounty report. The target was a web application reachable at http://[redacted]:8080, and the goal was to move through a chain of stages: escalate privileges on the web application, obtain a shell, analyse a shell script, analyse network traffic, and finally analyse logs to extract a flag.

The application presented a dashboard to unauthenticated visitors with limited guest privileges. Authentication was handled with JWT tokens, and the token payload carried a role claim, which for a guest was guest. That claim is the pivot for the first stage.

Setup

The pcap was downloaded to Kali, and the following tools and inputs appear in the report:

  • The auth_token cookie, replaced with the forged token.
  • base64, tr and echo for building the forged token.
  • dirb with /usr/share/wordlists/dirb/common.txt for directory brute-forcing.
  • ssh for shell access.
  • find, ls, cat and strings for local enumeration and traffic analysis.
  • scp to pull the packet capture to Kali.
  • unzip with a password.
  • grep and base64 -d for log analysis and flag decoding.

Finding it

The first observation was that the dashboard was reachable as a guest and that the application authenticated requests with a JWT. Decoding the token showed a payload containing a "role": "guest" claim.

Dashboard as Guest From the original on medium.com

The guest dashboard, with the limited privileges available before any tampering.

Exploitation

Step 1: JWT algorithm none attack

The technique used was the JWT alg: none attack. The forged token was built by setting the header to {"alg":"none","typ":"JWT"}, changing the payload role to admin, and leaving the signature empty.

The header and payload were base64url-encoded with the following commands:

Bash
echo -n '{"alg":"none","typ":"JWT"}' | base64 -w 0 | tr '+/' '-_' | tr -d '='
echo -n '{"user":"Vedant","role":"admin","iat":1788627401}' | base64 -w 0 | tr '+/' '-_' | tr -d '='

base64 -w 0 produces a single line with no wrapping, tr '+/' '-_' converts standard base64 characters to the URL-safe alphabet, and tr -d '=' strips the padding, which is what JWT expects. The payload sets the user to Vedant, the role to admin, and includes an iat timestamp.

The resulting forged token was:

Text
[redacted]
Terminal showing base64 encoding of header and payload From the original on medium.com

The terminal output of the base64 encoding steps for the header and payload.

Step 2: Replacing the cookie

The forged token was placed into the auth_token cookie, replacing the original value.

Malicious Cookie Insertion From the original on medium.com

The cookie being replaced with the forged token in the browser.

After the replacement, the application granted admin privileges.

Admin Dashboard From the original on medium.com

The dashboard after the cookie swap, now showing the admin view.

Step 3: Post-exploitation enumeration

With admin access, several menu options appeared, including User Management and System Configuration, but most links returned 404. Directory brute-forcing was then performed:

dirb results showing phpinfo.php From the original on medium.com

The dirb output, with phpinfo.php among the discovered paths.

The most valuable discovery was phpinfo.php.

phpinfo Environment section showing SSH credentials From the original on medium.com

The Environment section of the phpinfo.php page, which disclosed the SSH credentials.

The critical information disclosed there was:

Text
SSH_USER = capstone
SSH_PASS = [redacted]

Step 4: Gaining shell access

The leaked credentials were used to log in over SSH:

Bash
ssh [redacted]
Successful SSH login From the original on medium.com

A successful SSH login as capstone.

Step 5: Local enumeration and the mission briefing

The home directory was listed and a note read:

Bash
ls -la
cat note.txt
Home directory listing and note.txt From the original on medium.com

The home directory listing and the contents of note.txt.

The note hinted:

"Some Files are Hidden in the shadows"

Exploring the vault directory revealed multiple ZIP files and a hidden mission briefing:

Bash
ls -la vault/
cat vault/.note.txt
vault directory + Mission Briefing From the original on medium.com

The vault directory listing alongside the hidden mission briefing.

The briefing set out four tasks:

  1. Find the hidden .pcapng file.
  2. Extract the ZIP password from ICMP data.
  3. Calculate the correct ZIP name using backup.sh.
  4. Analyse the log for the brute-force attack and the flag.

Step 6: Finding the network capture

The capture was located with:

Bash
find / -name "*.pcapng" 2>/dev/null

The result was:

Text
/incident/response/team/Network_traffic.pcapng

Step 7: Calculating the correct ZIP file

The backup.sh script was read but never executed:

Bash
cat ~/backup.sh
Content of backup.sh From the original on medium.com

The contents of backup.sh.

Following the script's logic:

  • STAGE=PROD gives VAL = 15.
  • /incident/active.txt exists, so VAL = 30.
  • UID = 1002, so VAL = 42.

The correct archive was therefore svc_cron_42.zip.

Step 8: Extracting the ZIP password from traffic

The capture was copied to Kali:

Bash
scp [redacted]:/incident/response/team/Network_traffic.pcapng

Strings was then used to search for interesting material:

Bash
strings Network_traffic.pcapng | grep -i -E "pass|zip|secret|key|pwd|flag|svc_cron"
strings output revealing the password From the original on medium.com

The strings output, which revealed the password.

The password found was:

Text
X-Archive-Key-Zip-Password: Crimson2026

Step 9: Unzipping the archive

The archive was extracted with the recovered password:

Bash
unzip -P Crimson2026 /home/capstone/vault/svc_cron_42.zip
Successful unzip of svc_cron_42.zip From the original on medium.com

The successful extraction of svc_cron_42.zip.

The extracted file was internal_audit.log.

Step 10: Log analysis and flag extraction

The log contained JSON entries. Searching for login attempts revealed a brute-force attack originating from [redacted]:

Bash
grep "LOGIN_ATTEMPT" internal_audit.log
LOGIN_ATTEMPT entries From the original on medium.com

The LOGIN_ATTEMPT entries in the audit log.

One entry showed a successful login:

JSON
{
 "timestamp": "2026-02-26T14:27:38.184Z",
 "service": "AUTH_MODULE",
 "action": "LOGIN_ATTEMPT",
 "src_ip": "[redacted]",
 "status_code": 200,
 "target_user": "svc_admin",
 "msg": "Access Granted: Provisioning Session",
 "enc_data": "[redacted]"
}

The enc_data field was base64-decoded:

Bash
echo "[redacted]" | base64 -d

The final flag was:

Text
Flag{You_conquered_the_capstone!}

Root cause

After the forged token was placed in the cookie, the application granted admin privileges, which is consistent with the server accepting an unsigned token and trusting its role claim. In other words, the application did not enforce a fixed, expected signing algorithm and did not reject unsigned tokens, so the client could choose both the claims and the algorithm. The report does not show the server-side code, so the exact implementation is not stated; the behaviour is consistent with a library or hand-rolled verifier that honours the alg header instead of pinning it.

The later stages are not vulnerabilities in the same sense but a chain of information exposure and weak operational practice: phpinfo.php left reachable on the web root disclosed credentials, the ZIP password was recoverable from cleartext strings in a packet capture, and the flag was stored base64-encoded rather than protected in the audit log.

Impact

On the web application, the forged token gave the researcher admin privileges, which exposed menu options such as User Management and System Configuration. Most of those links returned 404, so the practical reach of the admin session in this environment was limited to what the application actually served.

The leaked SSH credentials gave a shell as capstone on the host. From there, the researcher could read the home directory, the vault directory and its hidden briefing, and the packet capture under /incident/response/team/. The capture contained the ZIP password in cleartext, which unlocked the archive and the audit log inside it, and the log contained the flag.

Fix

  • Pin the accepted algorithm on the server and reject tokens with alg: none or an empty signature. The verifier should not let the client choose the algorithm.
  • Remove phpinfo.php from the web root, or restrict it to trusted administrative access. It disclosed the SSH username and password.
  • Do not reuse the same credentials across the web tier and SSH, and rotate any credential that has been exposed in a page like phpinfo.
  • Do not carry secrets such as the ZIP password in cleartext through network traffic. The report shows the password recoverable with strings on the capture, so it should be protected in transit or not sent at all.
  • Do not store the flag, or any sensitive value, base64-encoded in an audit log. Base64 is an encoding, not protection.

Variants to test

  1. Algorithm confusion beyond none. On another target, take a token signed with an asymmetric algorithm and try re-signing it with the public key as an HMAC secret, or switch the header to a symmetric algorithm. A positive result is the server accepting the modified token and honouring the changed claims.
  2. Role claim tampering with a valid signature. If the server does verify signatures, check whether the role claim is re-checked server-side against the stored user. A positive result is a token whose signature is valid for a low-privilege user but whose payload claims admin still being accepted.
  3. Exposed diagnostic pages. Run dirb or a similar wordlist against other hosts and look for phpinfo.php, server-status pages or debug endpoints. A positive result is a page that prints environment variables, credentials or configuration.
  4. Secrets in packet captures. Pull any .pcapng or .pcap file you can reach and run strings with a keyword grep for pass, key, secret, pwd and flag. A positive result is a cleartext credential or header value in the output.
  5. Hidden files in user directories. After obtaining a shell, list directories with ls -la and look for dotfiles such as .note.txt. A positive result is a hidden file that contains instructions, credentials or paths to further stages.
  6. Script logic without execution. When you find a shell script that computes a value, read it with cat and trace the branches by hand rather than running it. A positive result is a deterministic value, such as the 42 in this challenge, that names the next artefact to use.
  7. Encoded data in logs. Grep audit logs for fields such as enc_data and try base64 decoding them. A positive result is readable text, which in this challenge was the flag.

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

What happened, in plain words

This is a walkthrough of a practice challenge, not a real bug bounty report. A challenge like this is a set of puzzles built on purpose so that someone learning security can practise breaking in, step by step, without touching a real company's systems. The target was a small web application running at http://[redacted]:8080, and the goal was to move through five stages: get more power on the website than a normal visitor has, get a command-line shell on the machine, read a script to work out a filename, look inside a network recording to find a password, and finally read a log file to find a hidden "flag". A flag is just a piece of text, often in the form Flag{...}, that proves you completed the challenge.

A few words before we start, because they come up constantly.

A web application is a program you use through a browser. You type an address, the browser asks a server for a page, and the server sends back HTML (the page structure), which the browser draws on screen.

A server is simply another computer, usually one you never see, that stores the website and answers requests. The address [redacted] is the server's location on the network, and :8080 is the "port", a numbered door on that machine. Think of the address as a street address and the port as the flat number.

A cookie is a small piece of text that a website asks your browser to keep and send back with every later request. It is how a website remembers who you are between page loads, because the web itself has no memory. Think of it as a cloakroom ticket: you show it, and the staff hand you the coat that belongs to that ticket. If someone can write their own ticket, they can ask for someone else's coat.

A token is similar in spirit: a string of characters that proves something, usually who you are and what you are allowed to do. A JWT (JSON Web Token) is a particular kind of token made of three parts separated by dots. The first part is a header saying how the token is signed, the second is the payload with the actual claims (facts such as your username and role), and the third is a signature that is supposed to prove the server issued it and nobody changed it. The header and payload are not encrypted, only encoded, so anyone holding the token can read them.

Encoding means changing how data is written without hiding it, like writing the same sentence in a different alphabet. Base64 is a common encoding that turns any data into letters, digits and a couple of symbols. It is not encryption: anyone can reverse it in one command.

A role is a label the application uses to decide what you may do. A guest role means limited access; an admin role means full access.

Privilege escalation means getting more permissions than you were given. Here it means going from guest to admin.

A shell is a text interface where you type commands and the computer runs them. Getting a shell on a remote machine means you can run commands on it as if you were sitting in front of it.

SSH (Secure Shell) is the standard way to open a shell on another computer over a network, protected by a username and password (or a key).

A packet capture (a .pcap or .pcapng file) is a recording of network traffic, like a tape recording of a phone call. Every message that crossed the wire is in there, and if something was sent without encryption, it is readable.

A log is a file where a program writes down what happened, one line or one record per event, usually with a timestamp. Logs are the first place anyone looks after an incident.

A flag in a challenge is the final prize text.

With those in hand, here is the whole chain, in the order it happened.

The starting point

The pcap was downloaded to Kali Linux, a Linux distribution that comes with security tools preinstalled. The tools used across the challenge were:

  • The auth_token cookie, replaced with the forged token.
  • base64, tr and echo, small command-line utilities for encoding text.
  • dirb, a tool that tries a long list of common file and folder names against a website to see which ones exist.
  • ssh, to open a shell on the target.
  • find, ls, cat and strings, for looking around the filesystem and inside files.
  • scp, to copy a file from the target back to Kali.
  • unzip, to open a password-protected ZIP archive.
  • grep and base64 -d, to search a log and decode text.

Stage 1: Getting in as a guest and forging an admin token

Opening the application in a browser showed a dashboard with limited guest privileges.

Dashboard as Guest From the original on medium.com

The guest dashboard, showing what a visitor can see before any tampering.

The application used JWT tokens for authentication. Looking at the token, the payload contained a claim "role": "guest". That is the interesting part: the role is written inside a token that the browser holds. So the question becomes whether the server actually checks the signature, or whether it simply reads the claims and believes them.

The vulnerability: the alg: none attack

The technique used is called the JWT algorithm none attack, written alg: none. The idea is this. A JWT header says which algorithm was used to sign the token. If a server trusts whatever algorithm the header names, an attacker can name none, meaning "no signature", and leave the signature part empty. A correctly written server would refuse such a token. A careless one accepts it and then trusts the payload inside.

The everyday comparison: imagine a bouncer who reads the line on your invitation that says "this invitation is verified by a stamp" and then, when the line says "no stamp needed", waves you through without checking anything. The attacker writes the invitation and chooses the rule.

To build the forged token, three things were done:

  1. Set the header to {"alg":"none","typ":"JWT"}.
  2. Change the payload role to admin.
  3. Leave the signature empty.

The header and payload were encoded with these commands:

Bash
echo -n '{"alg":"none","typ":"JWT"}' | base64 -w 0 | tr '+/' '-_' | tr -d '='
echo -n '{"user":"Vedant","role":"admin","iat":1788627401}' | base64 -w 0 | tr '+/' '-_' | tr -d '='

Line by line:

  • echo -n '...' prints the text between the quotes without adding a newline at the end. The -n matters because a stray newline would end up inside the encoded output and break the token.
  • | is a pipe: it takes the output of the command on the left and feeds it as input to the command on the right. It is how small tools are chained together.
  • base64 -w 0 encodes the text into base64. The -w 0 means "no line wrapping": without it, base64 inserts line breaks every so many characters, which would corrupt a token.
  • tr '+/' '-_' swaps the two base64 characters + and / for - and _. JWT uses this URL-safe variant of base64 because + and / have special meanings in URLs.
  • tr -d '=' deletes the = padding characters at the end. JWT strips them.

The first command encodes the header. The second encodes the payload. In the payload, the original user value is kept and only the role is changed to admin; iat is a standard JWT field meaning "issued at", a timestamp.

The two encoded pieces are joined with a dot, and because the signature is empty, the token ends with a dot and nothing after it. The resulting forged token was:

Text
[redacted]
Terminal showing base64 encoding of header and payload From the original on medium.com

The terminal output of the base64 encoding steps for the header and payload.

Putting the token into the cookie

The forged token was then placed into the auth_token cookie, replacing the original value. In a browser this is done through the developer tools, which let you view and edit the cookies the site has set.

Malicious Cookie Insertion From the original on medium.com

The cookie being replaced with the forged token in the browser.

After the replacement, the application granted admin privileges.

Admin Dashboard From the original on medium.com

The dashboard after the cookie swap, now showing the admin view.

Stage 2: Looking around as admin

With admin access, several menu options appeared, including User Management and System Configuration. Most of those links returned 404, which is the standard web error meaning "page not found". So the admin view looked promising but much of it was not actually implemented.

To find pages that were not linked in the menu, directory brute-forcing was performed:

What this does: dirb takes a base address and a wordlist, and tries every word in the list as a path under that address, for example http://[redacted]:8080/admin, http://[redacted]:8080/backup and so on. It reports which ones exist. The wordlist here is /usr/share/wordlists/dirb/common.txt, a file of common names that ships with the tool. The comparison: it is like trying every key on a big bunch in a door, one after another, and noting which one turns.

dirb results showing phpinfo.php From the original on medium.com

The dirb output, with phpinfo.php among the discovered paths.

The most valuable discovery was phpinfo.php.

phpinfo.php is a page that the PHP programming language can generate to show its configuration and environment. It is meant for developers during setup and should never be left on a public server, because it prints details about the machine, including environment variables. Environment variables are named values the system passes to programs, and they often hold configuration, sometimes including credentials.

phpinfo Environment section showing SSH credentials From the original on medium.com

The Environment section of the phpinfo.php page, which disclosed the SSH credentials.

The critical information disclosed there was:

Text
SSH_USER = capstone
SSH_PASS = [redacted]

In plain words: the page printed the username and password used to log in to the machine over SSH. That is a serious leak, because it turns a web-only problem into a way onto the server itself.

Stage 3: Opening a shell with the leaked credentials

The leaked credentials were used to log in over SSH:

Bash
ssh [redacted]

What this does: ssh opens an encrypted connection to the machine at [redacted], logging in as the user capstone. The user@host form is how SSH is told which account to use. After the command, SSH asks for the password, and the leaked one is typed in.

Successful SSH login From the original on medium.com

A successful SSH login as capstone.

A shell as capstone was obtained. From here on, everything happens on the target machine, not in the browser.

Stage 4: Looking around the home directory and finding the briefing

The home directory was listed and a note read:

Bash
ls -la
cat note.txt

Line by line:

  • ls lists the contents of the current directory. The -l flag asks for the long format, with permissions, owner, size and date. The -a flag asks to include hidden files, which on Linux are files whose names start with a dot. Without -a, those files are invisible in the listing.
  • cat prints the contents of a file to the screen. The name comes from "concatenate", but in practice it is the simplest way to read a file.
Home directory listing and note.txt From the original on medium.com

The home directory listing and the contents of note.txt.

The note hinted:

"Some Files are Hidden in the shadows"

That is a nudge to look for hidden files, which is why ls -la was used. Exploring the vault directory revealed multiple ZIP files and a hidden mission briefing:

Bash
ls -la vault/
cat vault/.note.txt

Here vault/ means the folder named vault inside the current directory, and .note.txt is a hidden file inside it, readable because of the leading dot and the -a flag.

vault directory + Mission Briefing From the original on medium.com

The vault directory listing alongside the hidden mission briefing.

The briefing set out four tasks:

  1. Find the hidden .pcapng file.
  2. Extract the ZIP password from ICMP data.
  3. Calculate the correct ZIP name using backup.sh.
  4. Analyse the log for the brute-force attack and the flag.

A word on two of those. ICMP is the protocol used by the ping command to check whether a machine is reachable; it carries small messages, and if someone puts text in them, that text can be read from a capture. A brute-force attack is trying many passwords in a row, quickly, until one works.

Stage 5: Finding the network capture

The capture was located with:

Bash
find / -name "*.pcapng" 2>/dev/null

Line by line:

  • find searches the filesystem for files matching a condition. The / means start at the very top of the filesystem, so the whole machine is searched.
  • -name "*.pcapng" matches any file whose name ends in .pcapng. The * is a wildcard meaning "anything".
  • 2>/dev/null throws away error messages. The 2 refers to the error output stream, and /dev/null is a special file that discards whatever is written to it. Without this, the search would be flooded with "permission denied" lines for folders the user cannot read.

The result was:

Text
/incident/response/team/Network_traffic.pcapng

That is the full path of the capture file: a folder called incident, then response, then team, then the file itself.

Stage 6: Working out the right ZIP file by reading a script

The backup.sh script was read but never executed:

Bash
cat ~/backup.sh

~ is shorthand for the current user's home directory, so this reads backup.sh from the home folder. Reading rather than running is deliberate: a script found on a compromised machine could do anything, including delete files or alert someone, so you read it first and understand it.

Content of backup.sh From the original on medium.com

The contents of backup.sh.

Following the script's logic by hand:

  • STAGE=PROD gives VAL = 15.
  • /incident/active.txt exists, so VAL = 30.
  • UID = 1002, so VAL = 42.

In other words, the script starts with a value, changes it depending on conditions, and ends with a number. Tracing those branches on paper gives 42. The correct archive was therefore svc_cron_42.zip, one of the ZIP files seen in the vault directory.

Stage 7: Finding the ZIP password in the network capture

The capture was copied to Kali:

Bash
scp [redacted]:/incident/response/team/Network_traffic.pcapng

scp copies files over SSH. The part before the colon is the login and host, and the part after is the path on that host. The file lands in the current directory on Kali, where the analysis tools are.

Strings was then used to search for interesting material:

Bash
strings Network_traffic.pcapng | grep -i -E "pass|zip|secret|key|pwd|flag|svc_cron"

Line by line:

  • strings reads a binary file and prints every run of readable text it can find. A capture file is binary, full of protocol headers, but any text that was sent across the network, unencrypted, appears in it as readable characters.
  • | pipes that output into the next command.
  • grep searches its input for lines matching a pattern and prints only those lines.
  • -i makes the search case-insensitive, so Pass and pass both match.
  • -E enables extended regular expressions, which is what allows the | characters inside the quotes to mean "or".
  • The pattern lists words likely to appear near a secret: pass, zip, secret, key, pwd, flag, and the archive name svc_cron.
strings output revealing the password From the original on medium.com

The strings output, which revealed the password.

The password found was:

Text
X-Archive-Key-Zip-Password: Crimson2026

This is a header, a labelled line of text, that was sent across the network in cleartext and captured. The label says what it is, and the value after the colon is the password.

Stage 8: Opening the archive

The archive was extracted with the recovered password:

Bash
unzip -P Crimson2026 /home/capstone/vault/svc_cron_42.zip

unzip extracts a ZIP archive. The -P flag supplies the password on the command line, followed by the full path of the archive. The archive opens, and the extracted file was internal_audit.log.

Successful unzip of svc_cron_42.zip From the original on medium.com

The successful extraction of svc_cron_42.zip.

Stage 9: Reading the log and decoding the flag

The log contained JSON entries. JSON is a text format for structured data: curly braces hold an object, and each entry is a name followed by a colon and a value, separated by commas. It is the format most programs use to write machine-readable logs.

Searching for login attempts revealed a brute-force attack originating from [redacted]:

Bash
grep "LOGIN_ATTEMPT" internal_audit.log

grep searches the named file for lines containing LOGIN_ATTEMPT and prints them.

LOGIN_ATTEMPT entries From the original on medium.com

The LOGIN_ATTEMPT entries in the audit log.

One entry showed a successful login:

JSON
{
 "timestamp": "2026-02-26T14:27:38.184Z",
 "service": "AUTH_MODULE",
 "action": "LOGIN_ATTEMPT",
 "src_ip": "[redacted]",
 "status_code": 200,
 "target_user": "svc_admin",
 "msg": "Access Granted: Provisioning Session",
 "enc_data": "[redacted]"
}

Reading the fields: timestamp is when it happened; service is which part of the system wrote the record; action is what kind of event it was; src_ip is the address the request came from; status_code 200 is the standard web code for success; target_user is the account being logged into; msg is a human-readable description; and enc_data is a field holding encoded data. The name suggests encryption, but the value is base64, which is only encoding.

The enc_data field was base64-decoded:

Bash
echo "[redacted]" | base64 -d

echo prints the string, the pipe passes it to base64, and -d means decode rather than encode. The output is the final flag:

Text
Flag{You_conquered_the_capstone!}

Why the first stage worked

After the forged token was placed in the cookie, the application granted admin privileges, which is consistent with the server accepting an unsigned token and trusting its role claim. In other words, it did not insist on one fixed signing algorithm and did not reject unsigned tokens, so the client could choose both the claims and the algorithm. The report does not show the server-side code, so the exact implementation is not stated; the behaviour fits a verifier that follows the alg header instead of pinning it.

The later stages are not bugs of the same kind. They are a chain of information exposure and weak practice: phpinfo.php was left reachable and printed credentials, the ZIP password travelled across the network in cleartext and was recoverable from the capture, and the flag sat in the audit log base64-encoded rather than protected.

What the attacker could reach

On the web application, the forged token gave admin privileges, which exposed menu options such as User Management and System Configuration. Most of those links returned 404, so the practical reach of the admin session in this environment was limited to what the application actually served.

The leaked SSH credentials gave a shell as capstone on the host. From there, the home directory, the vault directory and its hidden briefing, and the capture under /incident/response/team/ were all readable. The capture held the ZIP password in cleartext, which unlocked the archive and the audit log inside it, and the log held the flag.

How to fix it

  • Pin the accepted algorithm on the server and reject tokens with alg: none or an empty signature. The verifier should not let the client choose the algorithm.
  • Remove phpinfo.php from the web root, or restrict it to trusted administrative access. It disclosed the SSH username and password.
  • Do not reuse the same credentials across the web tier and SSH, and rotate any credential that has been exposed in a page like phpinfo.
  • Do not carry secrets such as the ZIP password in cleartext through network traffic. The report shows the password recoverable with strings on the capture, so it should be protected in transit or not sent at all.
  • Do not store the flag, or any sensitive value, base64-encoded in an audit log. Base64 is an encoding, not protection.

Other things to try on similar targets

  1. Algorithm confusion beyond none. On another target, take a token signed with an asymmetric algorithm and try re-signing it with the public key as an HMAC secret, or switch the header to a symmetric algorithm. A positive result is the server accepting the modified token and honouring the changed claims.
  2. Role claim tampering with a valid signature. If the server does verify signatures, check whether the role claim is re-checked server-side against the stored user. A positive result is a token whose signature is valid for a low-privilege user but whose payload claims admin still being accepted.
  3. Exposed diagnostic pages. Run dirb or a similar wordlist against other hosts and look for phpinfo.php, server-status pages or debug endpoints. A positive result is a page that prints environment variables, credentials or configuration.
  4. Secrets in packet captures. Pull any .pcapng or .pcap file you can reach and run strings with a keyword grep for pass, key, secret, pwd and flag. A positive result is a cleartext credential or header value in the output.
  5. Hidden files in user directories. After obtaining a shell, list directories with ls -la and look for dotfiles such as .note.txt. A positive result is a hidden file that contains instructions, credentials or paths to further stages.
  6. Script logic without execution. When you find a shell script that computes a value, read it with cat and trace the branches by hand rather than running it. A positive result is a deterministic value, such as the 42 in this challenge, that names the next artefact to use.
  7. Encoded data in logs. Grep audit logs for fields such as enc_data and try base64 decoding them. A positive result is readable text, which in this challenge was the flag.

Glossary

  • Admin: the role with the most permissions in an application.
  • Base64: an encoding that turns data into letters, digits and a few symbols. It is reversible by anyone and is not encryption.
  • Brute-force attack: trying many passwords or names in sequence until one works.
  • cat: a command that prints the contents of a file.
  • Cleartext: data sent without encryption, readable by anyone who can see the traffic.
  • Cookie: a small piece of text a website asks the browser to store and send back with later requests, used to remember who you are.
  • dirb: a tool that tries a wordlist of common names against a website to discover files and folders.
  • Encoding: changing how data is written without hiding it.
  • Environment variable: a named value the system passes to programs, often holding configuration and sometimes credentials.
  • find: a command that searches the filesystem for files matching a condition.
  • Flag: the prize text in a challenge, usually in the form Flag{...}.
  • grep: a command that searches text for lines matching a pattern.
  • Guest: the role with the fewest permissions, given to visitors who have not logged in.
  • HMAC: a way of signing data with a shared secret key, used by some JWT algorithms.
  • ICMP: the protocol used by ping to check whether a machine is reachable.
  • JSON: a text format for structured data, made of names and values in curly braces.
  • JWT (JSON Web Token): a token made of a header, a payload and a signature, separated by dots, used to prove identity and permissions.
  • JWT algorithm none attack: forging a JWT whose header says alg: none and whose signature is empty, hoping the server accepts it without checking.
  • Kali Linux: a Linux distribution with security tools preinstalled.
  • Log: a file where a program records events that happened, usually with timestamps.
  • ls: a command that lists the contents of a directory; -l gives detail and -a includes hidden files.
  • Packet capture: a recording of network traffic, stored in a .pcap or .pcapng file.
  • phpinfo.php: a PHP page that prints the server's configuration and environment, meant for development only.
  • Port: a numbered door on a machine, such as 8080, that a service listens on.
  • Privilege escalation: gaining more permissions than you were given.
  • Role: a label an application uses to decide what a user may do.
  • scp: a command that copies files between machines over SSH.
  • Server: a computer that stores a website or service and answers requests.
  • Shell: a text interface where you type commands and the computer runs them.
  • SSH (Secure Shell): the standard way to open an encrypted shell on another computer over a network.
  • strings: a command that prints the readable text found inside a binary file.
  • Token: a string of characters that proves identity or permissions.
  • unzip: a command that extracts a ZIP archive, optionally with a password.
  • Web application: a program you use through a browser, served by a remote computer.
  • Wordlist: a file of words that a tool tries one by one, such as common file names or passwords.
  • ZIP: a common archive format that packs files into one file, optionally protected by a password.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.