-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Priority
P1 - Medium-High
Summary
AWF uses Docker's default seccomp profile with no custom syscall restrictions. Combined with the NET_ADMIN capability, this creates an unnecessarily large attack surface. Dangerous syscalls like ptrace are available to code running in the container.
Current Behavior
The agent container runs with:
- Default Docker seccomp profile (allows ~300 syscalls)
NET_ADMINcapability (required for iptables)- No AppArmor profile
// src/docker-manager.ts:305-310
cap_add: ['NET_ADMIN'],
// No seccomp or AppArmor configurationSecurity Impact
Code running in the container can:
- Use
ptraceto inspect/modify other processes - Use
process_vm_readv/process_vm_writevfor memory access - Load kernel modules (if root)
- Potentially escape container via unpatched vulnerabilities
Proposed Solution
Add Custom Seccomp Profile
Create containers/agent/seccomp.json:
{
"defaultAction": "SCMP_ACT_ALLOW",
"syscalls": [
{
"names": ["ptrace", "process_vm_readv", "process_vm_writev"],
"action": "SCMP_ACT_ERRNO",
"errnoRet": 1,
"comment": "Block process inspection/modification"
},
{
"names": ["init_module", "finit_module", "delete_module"],
"action": "SCMP_ACT_ERRNO",
"errnoRet": 1,
"comment": "Block kernel module operations"
},
{
"names": ["kexec_load", "kexec_file_load"],
"action": "SCMP_ACT_ERRNO",
"errnoRet": 1,
"comment": "Block kernel replacement"
},
{
"names": ["reboot"],
"action": "SCMP_ACT_ERRNO",
"errnoRet": 1,
"comment": "Block system reboot"
},
{
"names": ["swapon", "swapoff"],
"action": "SCMP_ACT_ERRNO",
"errnoRet": 1,
"comment": "Block swap manipulation"
}
]
}Integrate in Docker Manager
// src/docker-manager.ts
security_opt: [
'no-new-privileges:true',
'seccomp=/path/to/seccomp.json'
],Implementation Steps
- Create
containers/agent/seccomp.jsonwith restricted syscalls - Modify
src/docker-manager.tsto apply seccomp profile - Add
no-new-privilegesto prevent privilege escalation - Test that iptables setup still works (needs specific syscalls)
- Test that common tools (curl, git, node, npm) still work
Files to Create/Modify
- New:
containers/agent/seccomp.json- Custom seccomp profile - Modify:
src/docker-manager.ts:305-310- Add security options - New: Tests for seccomp restrictions
Testing
- Verify ptrace is blocked:
strace lsshould fail - Verify iptables still works for setup
- Verify curl, git, node, npm work normally
- Verify no regression in existing functionality
Related
- NET_ADMIN capability issue (separate concern, should be addressed together)
Copilot
Metadata
Metadata
Labels
enhancementNew feature or requestNew feature or request