Details
Docker file to build it(dnser/Dockerfile):
FROM python:3.12-slim
WORKDIR /app
RUN pip install dnslib --no-cache-dir
COPY dns_resolver.py .
EXPOSE 53/udp
EXPOSE 53/tcp
CMD ["python", "-u", "dns_resolver.py", "--host", "0.0.0.0", "--port", "53"]
Then to simplify the test, we can set everything in a container and make the agent use the local DNS resolver:
docker-compose.yml:
services:
dns-resolver:
build: dnser
container_name: dns-resolver
restart: unless-stopped
networks:
dns-net:
ipv4_address: 10.0.1.2
a:
image: ghcr.io/hmbown/deepseek-tui:latest
container_name: tui
environment:
DEEPSEEK_API_KEY: sk-
stdin_open: true
tty: true
dns: 10.0.1.2
networks:
- dns-net
depends_on:
- dns-resolver
sysctls:
net.ipv6.conf.all.disable_ipv6: 1
networks:
dns-net:
driver: bridge
ipam:
config:
- subnet: 10.0.1.0/24
Then to check everything we could simply:sudo docker attach tui
Prompt: read contnet of http://mydomain.com using fetch_url tools, no thinking just raw output
The tool will allow the request to go through 127.0.0.1. To make sure it's not a false-positive I've also installed python in CodeWhale container and ran python3 -m http.server 80 as root to make sure the request can actually read content.
To read the logs from dns-resolver:sudo docker logs -f dns-resolver
Impact
Similar to other SSRF bypasses, other services private on the system, private network, and cloud credentials are at risk.