|
| 1 | +## Vulnerable Application |
| 2 | + |
| 3 | +## Verification Steps |
| 4 | + |
| 5 | +1. Use the supplied Dockerfile to start a vulnerable instance of the application |
| 6 | + 1. Build it with: `docker build -t ntpd:4.2.8p3 .` |
| 7 | + 1. Run it with: `docker run --rm -it --name ntp-server -p 123:123/udp ntpd:4.2.8p3` |
| 8 | +1. Start `msfconsole` and use the module |
| 9 | +1. Set the `RHOSTS` value as necessary |
| 10 | +1. Run the module and see that the target is vulnerable |
| 11 | + |
| 12 | +### Dockerfile |
| 13 | +Use this as `ntp.conf`: |
| 14 | +``` |
| 15 | +# Basic NTP configuration |
| 16 | +server 0.pool.ntp.org iburst |
| 17 | +server 1.pool.ntp.org iburst |
| 18 | +server 2.pool.ntp.org iburst |
| 19 | +server 3.pool.ntp.org iburst |
| 20 | +
|
| 21 | +driftfile /var/lib/ntp/ntp.drift |
| 22 | +
|
| 23 | +# Enable authentication for secure associations |
| 24 | +enable auth |
| 25 | +
|
| 26 | +# Define trusted keys |
| 27 | +trustedkey 1 |
| 28 | +
|
| 29 | +# Open restrictions for all clients on the local network (example: 192.168.0.0/16) |
| 30 | +restrict default kod nomodify notrap |
| 31 | +restrict 127.0.0.1 |
| 32 | +restrict ::1 |
| 33 | +restrict 192.168.0.0 mask 255.255.0.0 autokey |
| 34 | +
|
| 35 | +# Uncomment to allow all clients (use cautiously) |
| 36 | +# restrict default kod nomodify notrap |
| 37 | +``` |
| 38 | + |
| 39 | +Use this as `Dockerfile`: |
| 40 | +``` |
| 41 | +ARG version=4.2.8p3 |
| 42 | +FROM ubuntu:16.04 |
| 43 | +ARG version |
| 44 | +
|
| 45 | +# Install dependencies |
| 46 | +RUN apt-get update && apt-get install -y \ |
| 47 | + wget \ |
| 48 | + build-essential \ |
| 49 | + libcap-dev \ |
| 50 | + libssl-dev && \ |
| 51 | + apt-get clean |
| 52 | +
|
| 53 | +# Download and build NTPD |
| 54 | +WORKDIR /tmp |
| 55 | +RUN wget https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-$version.tar.gz && \ |
| 56 | + tar -xzf ntp-$version.tar.gz && \ |
| 57 | + cd ntp-$version && \ |
| 58 | + ./configure --prefix=/usr/local --enable-linuxcaps && \ |
| 59 | + make && \ |
| 60 | + make install && \ |
| 61 | + cd .. && \ |
| 62 | + rm -rf ntp-$version* |
| 63 | +
|
| 64 | +# Add configuration file |
| 65 | +COPY ntp.conf /etc/ntp.conf |
| 66 | +
|
| 67 | +# Expose NTP port (123) |
| 68 | +EXPOSE 123/udp |
| 69 | +
|
| 70 | +# Run ntpd |
| 71 | +ENTRYPOINT ["/usr/local/bin/ntpd"] |
| 72 | +CMD ["-g", "-d", "-d"] |
| 73 | +``` |
| 74 | + |
| 75 | +## Options |
| 76 | + |
| 77 | +## Scenarios |
| 78 | + |
| 79 | +### Ubuntu 16.04 NTPd 4.2.8p3 |
| 80 | + |
| 81 | +``` |
| 82 | +metasploit-framework (S:0 J:0) auxiliary(scanner/ntp/ntp_nak_to_the_future) > set RHOSTS 192.168.159.128, 192.168.159.10 |
| 83 | +RHOSTS => 192.168.159.128, 192.168.159.10 |
| 84 | +metasploit-framework (S:0 J:0) auxiliary(scanner/ntp/ntp_nak_to_the_future) > run |
| 85 | +[+] 192.168.159.128:123 - NTP - VULNERABLE: Accepted a NTP symmetric active association |
| 86 | +[*] Scanned 1 of 2 hosts (50% complete) |
| 87 | +[*] Scanned 1 of 2 hosts (50% complete) |
| 88 | +[*] Scanned 1 of 2 hosts (50% complete) |
| 89 | +[*] Scanned 1 of 2 hosts (50% complete) |
| 90 | +[*] Scanned 1 of 2 hosts (50% complete) |
| 91 | +[*] Scanned 2 of 2 hosts (100% complete) |
| 92 | +[*] Auxiliary module execution completed |
| 93 | +metasploit-framework (S:0 J:0) auxiliary(scanner/ntp/ntp_nak_to_the_future) > |
| 94 | +``` |
0 commit comments