Gawk
Gawk
Platform: HackTheBox | Category: Hardware | Difficulty: Very Easy | Author: D3v0o0Nu11 | Date: 2026-02-10
Description
I lost access to my computer and need a document urgently which got stuck in a printer. Can you get me the document?
Solution Approach
Core idea: Printer Exploitation. Using PRET to communicate with the printer.
Steps
-
In this challenge seems we are tasked to recover a document that got stuck in their printer.
-
Also we're given an instance which we can exploit using Printer Exploitation Toolkit (PRET). It's open source and posted at Github.
-
The github documentations also provided with the system operations executeable in every printer language.
-
Great! Let's follow the documentations.
-
Using
psresulting to no feedback but it connected. It means the printer does not understand the language which also correlates that it's not the correct printer language. -
Using
pjlshall resulting to the printer feedback! -
Noticed that it also provide the device name that we're going to exploit.
-
BUT, somehow we got
watchdog timeouteverytime we want to runlscommand even though thelscommand is available. -
Possibly because there is a session which has a timeout but does not terminate the shell directly.
-
Running the script again and execute
lsagain, the printer shall reflects the result to the terminal. -
Long story short, after traversing through the directory seems we found the stuck document at
saveDevice/SavedJobs/InProgressdirectory. -
To download the document we can use
getcommand. -
Upon attempt to render the PDF we got this result:
-
Interesting, after running a basic file check we found out that it contains base64 text.
-
Let's use cyberchef to decode it and download the content again from there.
-
Got the flag!
Flag
REDACTED
Lessons Learned
- Printer Exploitation.
- Using PRET to communicate with the printer.
- Identifying printer language.