Skip to content
Access control Write-up Beginner

Disabling ClamAV as an Unprivileged User

The ClamAV daemon's Unix socket was world-readable and world-writable, allowing any local unprivileged user to send commands such as SHUTDOWN and disable the antivirus service. An attacker with local access could therefore impair defences by stopping ClamAV.

DLL_Cool_J Follow

Published on archcloudlabs.com

ClamAV is an Open Source antivirus engine that is widely used on mail servers to scan incoming messages. On February 15, 2023 ClamAV published a security advisory detailing a potential remote code execution vulnerability in its HFS+ file parser.

Arch Cloud Labs (@DLL_Cool_J), on archcloudlabs.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The Unix socket used by clamd had permissions that allowed any local user to read and write to it, and the daemon did not check whether the caller was privileged before acting on commands such as SHUTDOWN.

Impact

A local unprivileged user could disable ClamAV scanning, impairing defences on the host.

What the attacker needed

Local access to the host; clamd running with a world-writable socket

The fix

The daemon should check that the caller is the root user before processing the SHUTDOWN command, as the referenced pull request addresses.

How it was found

  1. Install ClamAV and start the clamd daemon.
  2. List the open files of the clamd process to find its Unix socket.
  3. Check the permissions on the socket file and note that anyone can read or write it.
  4. Connect to the socket with netcat and send the SHUTDOWN command to stop the daemon.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

ClamAV is an antivirus program that runs in the background on mail servers. It listens on a special local file called a Unix socket, which other programs use to ask it to scan files. The mistake was that this socket allowed any user on the machine to send commands, including a command to shut ClamAV down, so a user without special rights could turn off the antivirus.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from ClamAV

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.