From Browser to Shell: Hacking the Edex-UI Terminal
The edex-ui terminal runs a local WebSocket server on port 3000 that accepts connections from any origin and passes raw data to the terminal. A malicious website visited by the user could connect to that socket and run arbitrary commands in the running terminal session.
medium.com
Published on medium.com
Back in 2023, a friend recommended a terminal called edex-ui. According to its official GitHub repository, edex-ui is:
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the local WebSocket server did not validate the Origin header or require any authentication, so any web page could open a connection to it.
Impact
A malicious website could hijack a running terminal session and execute arbitrary commands, though the developer argued the single-connection limit gives an attacker only a short window.
What the attacker needed
Edex-ui running locally; victim visits a malicious web page; attacker connects before the frontend does
The fix
The project was archived and no patch was released; it should be fixed by rejecting WebSocket connections whose Origin is not the terminal's own frontend and by requiring authentication.
How it was found
- Find the port the terminal's internal WebSocket server listens on by reading the source code.
- Capture traffic on that port to learn the message format.
- Write a web page that opens a WebSocket to the local port and sends a command.
- Open the page in a browser while the terminal is running and observe the command execute.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A terminal program on your computer was listening on a local network port for commands from its own window. It did not check who was connecting, so any web page you opened could also connect and type commands into your terminal, as if you had typed them yourself.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.