Skip to content

Commit 08e46d1

Browse files
committed
Add bandit14
1 parent 21dab6d commit 08e46d1

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# OverTheWire: Bandit Lvl 14 (Linux): Bandit (2026)
2+
3+
| Field | Value |
4+
|------------|-------|
5+
| Platform | OverTheWire |
6+
| Event | Bandit |
7+
| Date | 2026 |
8+
| Category | Linux |
9+
| Difficulty | Medium |
10+
| Points | N/A |
11+
| Solves | 0 |
12+
| Author | OverTheWire |
13+
| Solved by | leeadrian841 |
14+
| Status | Solved |
15+
| Tags | Linux, Networking, Netcat |
16+
17+
## TL;DR
18+
Talking to a local network service: a program is listening on TCP port 30000 of the same machine, so `nc localhost 30000` opens a raw connection to it, and sending the current password returns the next one.
19+
20+
## Challenge
21+
> The password for the next level can be retrieved by submitting the password of the current level to port 30000 on localhost.
22+
23+
- Files: None for this level
24+
- Service: `bandit14@bandit.labs.overthewire.org:2220` (online)
25+
26+
## First look
27+
I logged in as `bandit14` with the password that I had obtained from the previous level `bandit13`. This challenge asks me to submit it, so I first needed to find it in the current server. Every Bandit password is stored in `/etc/bandit_pass/`, and each file can only be read by its own user.
28+
29+
Next, I checked that something was really listening on port 30000. `nc` initiates TCP connections, send UDP packets and also listen on arbitrary TCP and UDP ports:
30+
- `-z` only checks whether the connection opens, without sending any data.
31+
- `-v` prints whether it worked.
32+
33+
```bash
34+
ssh bandit14@bandit.labs.overthewire.org -p 2220
35+
{Password for bandit14}
36+
37+
bandit14@bandit:~$ ls -A
38+
.bash_logout .bashrc .profile
39+
bandit14@bandit:~$ cat /etc/bandit_pass/bandit14
40+
{Password for bandit14}
41+
bandit14@bandit:~$ nc -zv localhost 30000
42+
Connection to localhost (127.0.0.1) 30000 port [tcp/*] succeeded!
43+
```
44+
45+
### Theory
46+
- **IP address:** the address of a machine on a network.
47+
- **localhost:** a name for "this same machine". It resolves to `127.0.0.1`, so the traffic never leaves the server.
48+
- **Port:** a number from 0 to 65535 that picks which program on the machine receives the traffic. One machine can run many services, each on its own port (SSH on 22 or 2220, HTTP on 80, this challenge on 30000).
49+
- **`nc` (netcat):** opens a plain TCP or UDP connection to a host and port. Whatever I type is sent to the service, and whatever the service replies is printed in my terminal. It is often called the "Swiss army knife" of networking.
50+
51+
## Dead ends
52+
- None
53+
54+
## Solution
55+
### Use `nc` to `localhost` via port 30000
56+
The service on port 30000 is not a website or a login prompt: it simply reads one line and replies. `nc` is the right tool because it sends exactly what I type over a raw TCP connection, with no protocol on top.
57+
58+
I connected with `nc localhost 30000`, pasted the password for `bandit14` and pressed Enter. The service replied `Correct!` followed by the password for `bandit15`.
59+
60+
```bash
61+
# nc to localhost via port 30000
62+
bandit14@bandit:~$ nc localhost 30000
63+
{Password for bandit14}
64+
Correct!
65+
{Password for bandit15}
66+
```
67+
68+
### Winning Command
69+
Instead of pasting the password by hand, I can pipe it straight from the password file into `nc`, which solves the level in one command.
70+
71+
```bash
72+
# Read the current password and submit it in one go
73+
bandit14@bandit:~$ cat /etc/bandit_pass/bandit14 | nc localhost 30000
74+
Correct!
75+
{Password for bandit15}
76+
```
77+
78+
## Flag
79+
`Password for bandit15`
80+
81+
## Lessons learned
82+
- Check which ports are open and listening with either `nc` or `ss -tln` before trying to connect.
83+
- Learn `nc` and its usages: it can send data to, and read replies from, any TCP or UDP service.
84+
- Understand that `localhost` is the machine itself, so a service can be reachable from inside the server even when it is not exposed to the internet.
85+
86+
## References
87+
- [nc](https://man.archlinux.org/man/nc.1.en)
88+
- [IP Address](https://en.wikipedia.org/wiki/IP_address)
89+
- [Localhost](https://en.wikipedia.org/wiki/Localhost)
90+
- [Port (computer_networking)](https://en.wikipedia.org/wiki/Port_(computer_networking))
91+
- [IP Addresses](https://computer.howstuffworks.com/web-server5.htm)
92+
- [Ports](https://computer.howstuffworks.com/web-server8.htm)
93+
- [How the Internet works in 5 minutes](https://www.youtube.com/watch?v=7_LPdttKXPc)

0 commit comments

Comments
 (0)