Egress control: a root agent can bypass no-network and allowlist by setting SO_MARK 114514

Open
#4,531 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Rome-1 is already working on this.

Since Dec 3, 2026.

  • #4619 by @Rome-1 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
docker, python

Research direction

Start with the network-policy rules at the cited lines 66 and 75, and trace how the GOST mark is trusted for egress. Compare the current allowlist behavior with the no-network change in #4376, then check the Docker service capabilities described in the report. Done means an agent cannot bypass allowlist by setting SO_MARK, while permitted traffic still works.

Written by the indexing model from the issue text.

Description

network-policy accepts any packet carrying GOST's mark (meta mark $GOST_MARK, lines 66 and 75; GOST_MARK=114514). Controlled services share the sidecar's network namespace and keep Docker's default CAP_NET_RAW, so a root agent can set the mark itself:

import socket
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_MARK, 114514)
s.connect(("example.com", 80))

This gets full TCP egress (HTTP 200); the same request without the mark fails. With cap_drop: [NET_RAW] on the agent service, or a non-root agent, setsockopt fails with EPERM.

Seen on 0.26.0 (docker); the rules are unchanged on main cf4bd004. #4376 removes the mark bypass for no-network only, so allowlist is still affected.

Repro and draft done with help from Claude agents.

Dominant language
Python
Stars
5.6k
Forks
1.9k
Avg merge
1d 17h
Merged PRs (30d)
156

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from harbor-framework/harbor

All issues in harbor-framework/harbor

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.