Skip to content
Crypto Write-up Beginner

The Elderly Man, a 2009 Breach, and Four Extra Keystrokes

A CTF challenge provided an unsalted MD5 hash of a flag-format password derived from a RockYou word plus four appended complexity characters. The author cracked it by trying RockYou words with all combinations of one special, one digit, one lowercase, and one uppercase character, recovering the flag.

Bleu I Bombade Follow

Published on medium.com

How a RockYou password and one predictable “make-it-complex” tweak gave up an MD5 flag after I wasted an hour hunting for Santa.

Bleu I Bombade, 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 MetaCTF password cracking challenge. The prompt is a short story with a hash attached to it:

“In December 2009, an elderly man’s credentials were compromised, compelling him to change his password. Years later, he cannot recall the new password, but he still has its hash. He recalls that the password was stored in flag format, based on his old password, with the addition of a special character, a number, a lowercase letter, and an uppercase letter.”

Hash: [redacted]

The hash is thirty-two hexadecimal characters, which is the length of an MD5 digest. The answer is therefore the MD5 of some string, and that string is a flag in the form MetaCTF{ something }. The task is to recover the something.

Setup

The challenge gives no accounts, no roles and no target application. The only inputs are the prompt text and the hash above. The researcher had no GPU available, so instead of hashcat he wrote a small multithreaded MD5 cracker in C. The wordlist is RockYou, the plaintext list of roughly 32 million passwords leaked in the December 2009 breach, which the report calls the default wordlist in every cracker.

Finding it

Two signals in the flavour text carry the actual information, and one piece of it is misdirection.

Signal one: December 2009. That is the month of the RockYou breach, which spilled roughly 32 million passwords in plaintext. “His credentials were compromised” in that month tells the solver that the old password is in RockYou.

Signal two: the mutation. “Based on his old password, with the addition of a special character, a number, a lowercase letter, and an uppercase letter” is a password-complexity policy described in English. A user forced to change a leaked password does the laziest thing available: keeps the old word and appends four characters to satisfy the “must contain upper/lower/number/symbol” rule. In cracking terms that is a hybrid dictionary plus mask attack: a RockYou word followed by the mask ?s?d?l?u, all wrapped in MetaCTF{…}.

The plaintext therefore has a specific shape:

Text
MetaCTF{ <rockyou_word> <special><digit><lower><upper> }

The misdirection is the “elderly man” and the December setting. The researcher first assumed Santa Claus and built a themed list around santa, northpole and hohoho. Then he tried Ebenezer Scrooge, another elderly man in a December story. Then Carl from Up (2009), a literal elderly man, with ellie, paradisefalls and carl. Every candidate was brute-forced in all 24 orderings of the four appended characters, against both possible hash framings, and none matched. The “elderly man” was decoration, not a decoder. Only RockYou and the mutation rule mattered.

Exploitation

Step 1: The intended hashcat invocation

The clean solution is a single hashcat line on a GPU, using attack mode 6 (hybrid wordlist plus mask):

Text
hashcat -m 0 -a 6 hash.txt rockyou.txt ?s?d?l?u# (with a rule to wrap the guess in MetaCTF{...})

-m 0 selects raw MD5 and -a 6 selects the hybrid wordlist plus mask mode, so each RockYou word is combined with the four-character mask ?s?d?l?u. The trailing comment notes that a rule is needed to wrap each guess in MetaCTF{...} before hashing, because the hash covers the whole flag string, brackets included.

Step 2: Writing a CPU cracker

Without a GPU, the researcher wrote a multithreaded MD5 cracker in C. It reads RockYou and, for each word, brute-forces the suffix: 33 specials × 10 digits × 26 lowercase × 26 uppercase, which is 223,080 combinations per word. Each candidate is hashed as the full MetaCTF{…} string and compared against the target.

One compile error cost a few minutes and is worth recording:

Text
out[2] = 0x98badcfe+c; // error: invalid suffix "+c" on integer constant

The C tokenizer reads 0x98badcfe, then treats e+c as a floating-point exponent in the style of 1e+5, and rejects it. A hex constant that happens to end in e, followed by +, is a genuine C footgun. A single space, 0x98badcfe + c, fixes it.

Step 3: Verifying the cracker

Before trusting the tool on the real hash, the researcher planted a known hash and confirmed the tool recovered it exactly:

Text
$ ./crack # target = md5("MetaCTF{password!1aA}")FOUND: MetaCTF{password!1aA} <-- MD5 implementation verified

The tool printed the planted plaintext, confirming the MD5 implementation was correct.

Step 4: Running against the real hash

With the cracker verified, he pointed it at the real hash and walked RockYou in the order it is stored, most common first. An elderly man’s password is likely a common one, so if the model was right the answer would surface early. It did, a few thousand words in:

Text
MATCH mode0 order[0123] word=alexandria :MetaCTF{alexandria#0lA}

The base word is alexandria, a name that sits comfortably in the RockYou top few thousand, followed by exactly the four characters the riddle promised, in exactly the order it listed them: a special #, a number 0, a lowercase l, an uppercase A.

Step 5: Verifying the match independently

A match is a claim, so the researcher recomputed the MD5 outside his own tool:

Text
$ python3 -c "import hashlib; \print(hashlib.md5(b'MetaCTF{alexandria#0lA}').hexdigest())"[redacted] # == the given hash, exactly

The output is byte-for-byte the target hash. The hash is taken over the whole flag string, brackets and all, and the plaintext decomposes exactly into the story: base word alexandria, plus # (special), 0 (number), l (lowercase) and A (uppercase).

FLAG CAPTURED, MetaCTF{alexandria#0lA}

Root cause

Four properties of the design make the password recoverable:

  1. The hash is unsalted MD5. Thirty-two hex characters, no salt, no iteration. A raw MD5 falls instantly to a dictionary or mask attack, with nothing to slow an attacker down.
  2. The base is a leaked password. RockYou is public plaintext, so the “secret” part of the password was never secret. The search space collapses from all strings to the known words in the list.
  3. The mutation is predictable. Appending one symbol, one digit, one lowercase and one uppercase adds only about 223,000 possibilities per word, a rounding error for a cracker and not the security the complexity rule imagines it provides.
  4. Common-first ordering wins. RockYou is frequency-sorted, and the persona is an elderly man, so walking from the top surfaces the answer long before the wordlist is exhausted.

Impact

In the challenge, the impact is a captured flag. The real-world lesson underneath is how real accounts fall: a password leaks, a policy forces a change, and a tired human keeps the word they know and sprinkles in the minimum symbols to get past the validator. Years later the “new” password is just as crackable as the old one, because every step was predictable: the base from a public breach, the mutation from a public rule. Attackers apply these exact mutation rules automatically.

Fix

Never store passwords as raw MD5. MD5 is fast and unsalted here, which is exactly what an attacker wants. Modern password storage uses a slow, salted, memory-hard function such as bcrypt, scrypt or Argon2, so that even a known wordlist takes impractically long and identical passwords do not share a hash.

Do not rebuild a breached password. After a leak, “old password plus a symbol and a number” is not a new password; it is the old password wearing a fake mustache. A compromised credential demands a genuinely new secret, ideally a long random one from a password manager.

Complexity rules are theatre without length. “One of each character class” barely dents the keyspace. Length and unpredictability are what matter, and a four-character suffix on a dictionary word provides neither.

Variants to test

  1. Different mask orderings. If the prompt lists the character classes in a different order, or does not list them at all, try all 24 permutations of the four appended characters. A positive result is a match against the target hash.
  2. Prefix instead of suffix. Some users prepend the complexity characters rather than appending them. Try the mask before the word as well as after it.
  3. Capitalisation and leetspeak on the base word. Try the RockYou word with its first letter capitalised, or with common substitutions such as a to @ and o to 0. A positive result is a recovered plaintext that still fits the flag format.
  4. Other breach wordlists. If the date in the prompt points to a different breach, swap RockYou for the matching public wordlist. A positive result is the answer surfacing early in a frequency-sorted list.
  5. Hash identification first. Count the hex characters before anything else: 32 suggests MD5, 40 suggests SHA-1, 64 suggests SHA-256. A positive result is a digest length that matches a known algorithm, which tells you which mode to select in your cracker.

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

What happened, in plain words

A capture-the-flag (CTF) challenge gave me a short story and a long string of letters and numbers. The story described an old man whose password was stolen in December 2009, who was then forced to pick a new one, and who years later could only remember that the new password was built from the old one by adding a few extra characters. The long string was a fingerprint of that new password, and my job was to work backwards from the fingerprint to the password itself.

I spent about an hour chasing a wrong idea (that the old man was Santa Claus) before I noticed the real clue was the date. December 2009 is when a famous list of leaked passwords called RockYou was breached. Once I stopped guessing and let that list do the work, the password fell out a few thousand entries in. The whole exercise is a small lesson in how real accounts get broken: a leaked password, a lazy change, and a predictable pattern.

The challenge text

The prompt reads like a bedtime story with a fingerprint stapled to the end:

“In December 2009, an elderly man’s credentials were compromised, compelling him to change his password. Years later, he cannot recall the new password, but he still has its hash. He recalls that the password was stored in flag format, based on his old password, with the addition of a special character, a number, a lowercase letter, and an uppercase letter.”

Hash: [redacted]

Before going further, three words in that text need unpacking.

  • Credentials is just the username and password pair that lets you log in somewhere. “Compromised” means someone else got hold of them.
  • A hash is the output of a one-way scrambling function. You feed in some text (the password, in this case) and get back a fixed-length string of characters. The same input always gives the same output, but you cannot run it backwards to recover the input. Think of it like a fingerprint: it identifies a person, but you cannot rebuild the person from the fingerprint. To check a password, a system hashes what you typed and compares the result to the stored hash.
  • Flag format means the answer is wrapped in a known prefix and braces, here MetaCTF{ something }. The something is what I need to find.

Step 1: Reading the hash

The hash is thirty-two characters long and uses only the digits 0 to 9 and the letters a to f. That is the signature of hexadecimal, a way of writing numbers in base 16, and thirty-two hex characters is exactly the length of an MD5 digest. MD5 is an old hashing algorithm that produces a 128-bit fingerprint, which is written out as 32 hex characters.

So the situation is: the answer is the MD5 of some string, and that string is a flag of the form MetaCTF{ something }.

This is a password cracking challenge. Cracking does not mean breaking the maths of the hash. It means guessing candidate passwords, hashing each guess, and checking whether the result matches the target. If it does, you have found the input. The only question is how to guess smartly instead of randomly.

Step 2: Finding the two real clues

The story contains two pieces of information that actually matter, and one piece that is a distraction.

Clue one: December 2009. That is not a random date. It is the month of the RockYou breach, in which roughly 32 million passwords were leaked in plaintext. Because so many of those passwords were weak and reused, the list became the standard starting wordlist for password crackers, usually stored as a file called rockyou.txt. When the story says the man’s credentials were compromised in that month, it is telling me his old password is somewhere in that list.

A wordlist is simply a text file with one candidate password per line, ordered roughly from most common to least common. Crackers try each line in turn.

Clue two: the mutation. The phrase “based on his old password, with the addition of a special character, a number, a lowercase letter, and an uppercase letter” is a password policy written out in English. Many websites require passwords to contain an uppercase letter, a lowercase letter, a digit and a symbol. When a user is forced to change a leaked password, the laziest way to satisfy that rule is to keep the old word and stick four extra characters on the end.

In cracking terms, that pattern is a hybrid dictionary plus mask attack. “Dictionary” means try words from the wordlist. “Mask” means try every combination of a fixed pattern of character types. The mask here is written ?s?d?l?u, where each ?x stands for a class of character:

Mask Meaning
?s any special character (symbol)
?d any digit
?l any lowercase letter
?u any uppercase letter

So the plaintext I am looking for has a very specific shape:

Text
MetaCTF{ <rockyou_word> <special><digit><lower><upper> }

Read that as: the prefix MetaCTF{, then a word taken from RockYou, then one symbol, one digit, one lowercase letter and one uppercase letter, then the closing }. The hash covers the whole string, braces included, so every guess must be wrapped the same way before hashing.

Step 3: The wrong turn

I want to be honest about the detour, because it is half the lesson. “An elderly man… December.” My brain jumped straight to Santa Claus. An old man, a December date, stolen credentials: surely the base word was santa, or northpole, or hohoho. I built a themed list.

Then I thought: maybe it is Ebenezer Scrooge, another elderly man in a December story. Then I noticed the film Up came out in 2009, and its hero Carl is a literal elderly man, so I tried ellie, paradisefalls and carl.

For each of those candidates I tried all 24 possible orderings of the four appended characters, because the story lists them in one order but a real user might type them in any order. I also tried both possible hash framings. Nothing matched. Santa was a dead end, Scrooge was a dead end, Carl was a dead end.

The “elderly man” was decoration, not a decoder. The only clue that carried real information was RockYou, and the fix was to stop being clever and let the wordlist do its job.

Step 4: The intended tool

The clean way to solve this, if you have a graphics card, is a single hashcat command. Hashcat is a popular free password-cracking program that can run on a GPU, which is far faster at this kind of repetitive maths than a normal processor.

Text
hashcat -m 0 -a 6 hash.txt rockyou.txt ?s?d?l?u# (with a rule to wrap the guess in MetaCTF{...})

Line by line:

  • hashcat runs the program.
  • -m 0 selects the hash type. Mode 0 is raw MD5, which matches the 32-character fingerprint I was given.
  • -a 6 selects the attack mode. Mode 6 is the hybrid wordlist plus mask mode, so each word from the list is combined with the mask that follows.
  • hash.txt is a file containing the target hash.
  • rockyou.txt is the wordlist of leaked passwords.
  • ?s?d?l?u is the mask: one symbol, one digit, one lowercase letter, one uppercase letter, appended to each word.
  • The trailing note records that a rule is also needed to wrap each guess in MetaCTF{...} before hashing, because the hash covers the whole flag string, brackets included.

Step 5: Writing my own cracker

I did not have a GPU in front of me, so I wrote a small multithreaded MD5 cracker in C. Multithreaded means the program splits the work across several processor cores at once, so it finishes sooner. C is a low-level programming language, fast but unforgiving about small mistakes.

The program reads RockYou, and for each word it brute-forces the four-character suffix. “Brute-force” here means trying every possibility in a defined set rather than guessing cleverly. The set is:

  • 33 special characters
  • 10 digits
  • 26 lowercase letters
  • 26 uppercase letters

Multiply those together and you get 223,080 combinations per word. For each combination the program builds the full MetaCTF{…} string, hashes it, and compares the result to the target hash. If they match, it prints the plaintext.

One compile error cost me a few minutes and is too good not to share. This line refused to compile:

Text
out[2] = 0x98badcfe+c; // error: invalid suffix "+c" on integer constant

What is happening: 0x98badcfe is a number written in hexadecimal (the 0x prefix means “what follows is hex”). The C compiler reads the number, then sees e+c and interprets it as a floating-point exponent, the same style as 1e+5 meaning “one times ten to the fifth”. A hex constant that happens to end in e, followed immediately by +, is a genuine C footgun. A single space fixes it: 0x98badcfe + c.

Step 6: Testing the cracker before trusting it

Before pointing the tool at the real hash, I planted a known one and confirmed the tool recovered it exactly. This is the same idea as testing a calculator on 2 + 2 before using it for your taxes: if it cannot solve a problem whose answer you already know, it cannot be trusted on the real one.

Text
$ ./crack # target = md5("MetaCTF{password!1aA}")FOUND: MetaCTF{password!1aA} <-- MD5 implementation verified

Line by line:

  • $ ./crack runs my compiled program from the current directory.
  • # target = md5("MetaCTF{password!1aA}") is a comment recording the planted test string.
  • FOUND: MetaCTF{password!1aA} is the program’s output: it recovered the planted plaintext.
  • <-- MD5 implementation verified is my note that the hashing code works.

Step 7: Running against the real hash

With the cracker verified, I pointed it at the real hash and walked RockYou in the order it is stored: most common first. The reasoning was that an elderly man’s password is likely a common one, so if my model was right, the answer would surface early rather than near the end of the list.

It did, a few thousand words in:

Text
MATCH mode0 order[0123] word=alexandria :MetaCTF{alexandria#0lA}

Line by line:

  • MATCH means the program found a candidate whose hash equals the target.
  • mode0 records that it was running in MD5 mode.
  • order[0123] records the order of the four appended characters: symbol, digit, lowercase, uppercase, which is the order the story listed them in.
  • word=alexandria is the base word taken from RockYou.
  • :MetaCTF{alexandria#0lA} is the full plaintext that produced the matching hash.

The base word is alexandria, which the report describes as sitting comfortably in the RockYou top few thousand. It is followed by exactly the four characters the riddle promised, in exactly the order it listed them: a special #, a number 0, a lowercase l, an uppercase A. No Santa required. The mundane wordlist beat the clever theory.

Step 8: Checking the answer independently

A match is a claim, and a claimed flag is worth ten seconds to prove. One collision in a 128-bit space is astronomically unlikely to be an accident, but I still recomputed the MD5 by hand, outside my own tool, so that a bug in my program could not fool me:

Text
$ python3 -c "import hashlib; \print(hashlib.md5(b'MetaCTF{alexandria#0lA}').hexdigest())"[redacted] # == the given hash, exactly

Line by line:

  • $ python3 -c "..." runs a short Python program directly from the command line.
  • import hashlib loads Python’s built-in library of hashing functions.
  • hashlib.md5(b'MetaCTF{alexandria#0lA}') hashes the candidate string. The b prefix means “treat this as raw bytes”, which is what hashing functions expect.
  • .hexdigest() prints the result as hex characters.
  • The output is [redacted], which is byte-for-byte the target hash.

The hash is taken over the whole flag string, brackets and all, and the plaintext decomposes precisely into the story: base word alexandria, plus # (special), 0 (number), l (lowercase) and A (uppercase).

FLAG CAPTURED, MetaCTF{alexandria#0lA}

Why it worked

Four properties of the design made the password recoverable:

  1. The hash is unsalted MD5. A salt is random extra data mixed into a password before hashing, so that two users with the same password get different hashes and precomputed tables become useless. Here there is no salt and no repeated hashing (no iteration), so a raw MD5 falls instantly to a dictionary or mask attack. There is nothing to slow an attacker down.
  2. The base is a leaked password. RockYou is public plaintext, so the “secret” part of the password was never secret. The search space collapses from “all possible strings” to the known words in the list.
  3. The mutation is predictable. Appending one symbol, one digit, one lowercase and one uppercase adds only about 223,000 possibilities per word. That is a rounding error for a cracker, not the security the complexity rule imagines it provides.
  4. Common-first ordering wins. RockYou is sorted by frequency, and the persona is an elderly man, so walking from the top surfaces the answer long before the wordlist is exhausted.

What this means in the real world

In the challenge, the impact is a captured flag. The real-world lesson underneath is how real accounts fall. A password leaks. A policy forces a change. A tired human keeps the word they know and sprinkles in the minimum symbols to get past the validator. Years later the “new” password is just as crackable as the old one, because every step was predictable: the base from a public breach, the mutation from a public rule. Attackers apply these exact mutation rules automatically.

How to fix it

Never store passwords as raw MD5. MD5 is fast and unsalted here, which is exactly what an attacker wants. Modern password storage uses a slow, salted, memory-hard function such as bcrypt, scrypt or Argon2, so that even a known wordlist takes impractically long and identical passwords do not share a hash.

Do not rebuild a breached password. After a leak, “old password plus a symbol and a number” is not a new password; it is the old password wearing a fake moustache. A compromised credential demands a genuinely new secret, ideally a long random one from a password manager.

Complexity rules are theatre without length. “One of each character class” barely dents the keyspace, the total number of possible passwords an attacker would have to try. Length and unpredictability are what matter, and a four-character suffix on a dictionary word provides neither.

Variations worth trying

If you meet a similar challenge, these are the variations to test:

  1. Different mask orderings. If the prompt lists the character classes in a different order, or does not list them at all, try all 24 permutations of the four appended characters. A positive result is a match against the target hash.
  2. Prefix instead of suffix. Some users prepend the complexity characters rather than appending them. Try the mask before the word as well as after it.
  3. Capitalisation and leetspeak on the base word. Try the RockYou word with its first letter capitalised, or with common substitutions such as a to @ and o to 0. A positive result is a recovered plaintext that still fits the flag format.
  4. Other breach wordlists. If the date in the prompt points to a different breach, swap RockYou for the matching public wordlist. A positive result is the answer surfacing early in a frequency-sorted list.
  5. Hash identification first. Count the hex characters before anything else: 32 suggests MD5, 40 suggests SHA-1, 64 suggests SHA-256. A positive result is a digest length that matches a known algorithm, which tells you which mode to select in your cracker.

Glossary

  • Argon2: a modern password-hashing function designed to be slow and to require a lot of memory, which makes mass guessing expensive.
  • bcrypt: a widely used password-hashing function that is deliberately slow and includes a salt.
  • Brute-force: trying every possibility in a defined set rather than guessing cleverly.
  • C: a low-level, fast programming language often used for tools that need to be efficient.
  • Credentials: the username and password pair used to log in somewhere.
  • CTF (capture the flag): a puzzle or competition in security where the goal is to find a hidden string called a flag.
  • Digest: another word for the output of a hash function.
  • Flag: the answer string in a CTF, here wrapped as MetaCTF{...}.
  • Hash: a one-way function that turns any input into a fixed-length fingerprint; the same input always gives the same output, but you cannot reverse it.
  • Hashcat: a free password-cracking program that can use a graphics card to try guesses very quickly.
  • Hexadecimal: a way of writing numbers in base 16, using digits 0 to 9 and letters a to f.
  • Hybrid dictionary plus mask attack: a cracking method that combines words from a wordlist with every combination of a fixed character pattern.
  • Iteration: repeating a hashing step many times on purpose, to make each guess slower for an attacker.
  • Keyspace: the total number of possible passwords an attacker would have to try.
  • Mask: a pattern describing which types of character go in which positions, such as ?s?d?l?u.
  • MD5: an old hashing algorithm that produces a 128-bit fingerprint, written as 32 hex characters.
  • Multithreaded: a program that splits its work across several processor cores at once.
  • Password cracking: guessing candidate passwords, hashing each one, and checking whether it matches a stolen hash.
  • Plaintext: the original readable text, here the actual password before hashing.
  • RockYou: a list of roughly 32 million passwords leaked in December 2009, still the default wordlist for most crackers.
  • Salt: random extra data mixed into a password before hashing, so identical passwords produce different hashes.
  • scrypt: a password-hashing function designed to be slow and memory-hard.
  • SHA-1 / SHA-256: other hashing algorithms, producing 40 and 64 hex characters respectively.
  • Unsalted: hashed without a salt, so identical passwords produce identical hashes and precomputed tables work.
  • Wordlist: a text file of candidate passwords, one per line, usually ordered from most common to least common.

More by Bleu I Bombade

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.