How to Protect yourself from Evil AI Agents

Cartoon character in a blue FocusCloud.dev hoodie running with a backpack and books.

If you want to detect, monitor, contain and block AI agents on an Ubuntu server, you need several layers of security. No single tool can reliably stop an agent from escaping its permitted environment.

Will use a server case running Ubuntu and Docker.

  1. Detect unauthorised agent activity.
  2. Monitor files, processes and network connections.
  3. Prevent access to unauthorised files and services.
  4. Stop suspicious processes and containers.
  5. Preserve logs and evidence for investigation.

1. Tools for detecting and blocking agents

ToolDetects / blocksMain purpose
FalcoDetectsDetects suspicious processes, system calls, container escapes and file access. Falco
WazuhDetects + respondsMonitors files, processes, logs, vulnerabilities and can trigger blocking actions. Components ยท Wazuh documentation+1
TetragonDetects + enforceseBPF-based runtime security and process/network policy enforcement.
auditdDetects / recordsRecords who accessed files, executed commands and changed system settings.
osqueryDetectsInvestigates running processes, users, services and system configuration.
SuricataDetects + blocksNetwork intrusion detection and prevention.
CrowdSecDetects + blocksIdentifies malicious IP addresses and coordinates blocking decisions.
Fail2banBlocksBlocks repeated suspicious login attempts.
ClamAVDetectsScans files for known malware.
AIDEDetectsDetects unexpected changes to protected files.

2. Tools that actually restrict agent behaviour

Detection is not enough. You also need enforcement.

ToolWhat it prevents
AppArmorRestricts which files and resources a process can access.
SeccompRestricts which Linux system calls a process can execute.
nftablesBlocks unauthorised network connections.
gVisorAdds an isolation layer between containers and the host kernel.
Docker rootless modeReduces the privileges available to Docker and its containers.
BubblewrapCreates restricted process environments and filesystem namespaces.

These tools complement one another; none guarantees that every attack or escape will be prevented.

3. My recommended security stack for FocusCloud.dev

Recommended architecture

I would combine these tools rather than install everything.

FocusCloud Agent Defence

Falco + Tetragon

Runtime behaviour detection and enforcement

Wazuh + auditd

Monitoring, logging and investigation

AppArmor + Seccomp + Docker isolation

Restrict agent permissions and system access

nftables + Suricata

Network monitoring and blocking

4. What I would specifically watch for

For AI agents running through Langflow, Ollama or customer-created applications, establish alerts for:

  • Agents attempting to read /etc/shadow.
  • Attempts to access another customer’s project directory.
  • Unexpected access to /root.
  • Attempts to access Docker socket /var/run/docker.sock.
  • Unexpected shell execution.
  • Attempts to install packages or create new users.
  • Unexpected outbound connections.
  • Attempts to modify Nginx or firewall configuration.
  • Attempts to access host filesystems from containers.
  • Attempts to disable security monitoring.

Important: These tools detect suspicious behaviour, not whether a process is inherently an AI agent. You need process identity, container identity and behavioural policies to distinguish authorised agents from ordinary applications.

5. Installation priority

My suggested order:

  1. AppArmor โ€“ restrict filesystem access.
  2. Docker isolation โ€“ separate customer environments.
  3. Falco โ€“ detect suspicious runtime behaviour.
  4. Wazuh โ€“ central monitoring and response.
  5. nftables โ€“ enforce network restrictions.
  6. Tetragon โ€“ add advanced runtime enforcement.

Official documentation:

One important recommendation: Never give an AI agent unrestricted Docker socket access or root privileges. A monitoring tool cannot compensate for an agent that already has unrestricted control of the host.

For FocusCloud, I would start by implementing a security boundary around every customer agent, then add automatic detection and quarantine. Critical actions such as deleting files, terminating shared services or changing firewall rules should require human approval.

1

Discover more from CONTEXT EDUCATION

Subscribe to get the latest posts sent to your email.

Leave a Reply