A developer used Claude Code to build a Telegram bot for mental math practice. During the development process, the AI configured a Docker Compose file that inadvertently exposed the PostgreSQL database port to the public internet.

The server experienced persistent performance issues due to high load. An investigation revealed that an attacker had scanned the server, identified the open port 5432, and gained unauthorized access to the database using a compromised password.

The attacker utilized the PostgreSQL superuser privileges, granted by default in the official image, to execute system commands via the COPY FROM PROGRAM function. This allowed the unauthorized deployment of a cryptocurrency miner on the host.

The developer opted to reinstall the server rather than attempt a partial cleanup. To prevent future incidents, the author recommends defining clear architectural boundaries, restricting network access, and implementing strict project-specific instructions for AI coding agents.

The author emphasizes that AI agents should not be given broad permissions. Instead, developers should provide detailed plans, set specific constraints, and verify infrastructure changes by reviewing the diff before applying any updates to the production environment.