Daniel Bae
Menu

Defensive edition

Cap and the privileges behind a packet capture

Daniel BaeOriginally published

SecurityHack The BoxLinux Capabilities

A five-second network snapshot can outlive the problem it was taken to diagnose. On Cap, an old capture still contained a usable login.

Who can read a capture?

The dashboard let a visitor create a short packet capture and download the result. It also served a capture from an earlier session, belonging to another user, to a visitor who had not signed in. The record number was the only control. The service checked that the record existed and missed the question of who was entitled to read it. The older file held a credential sent in cleartext, and that credential was not confined to the service that had sent it.

I would check ownership on both the record view and the file download. Tests should cover a signed-out request and two ordinary accounts, each asking for a capture that belongs to the other. A random identifier would only make records harder to find; it is no substitute for that check. Retention matters as well. Someone responding to this exposure would need to identify the affected capture files and rotate any credentials they recorded, including copies reused by other services.

What needs the privilege?

A general-purpose interpreter on the host carried a Linux capability that allows a process to change its user identity. An interpreter runs whatever program its caller supplies, so a capability attached to it belongs to every account that can execute it. Limiting what the dashboard did with the interpreter would not have limited anyone else.

The source suggests the capability was added so the site could capture traffic. That is a possible intent. It is not evidence that the identity-changing capability was ever needed for packet capture.

For a service like this I would inventory the capabilities attached to its executables, compare that list with an approved baseline and remove the interpreter’s elevation. If capturing packets requires special access, a dedicated helper can hold just that permission. Moving authentication to an encrypted transport and giving each service its own credentials addresses the separate risk already present in the stored file.