PortGate

Advisories · Linux & SSH

CVE-2021-3156 High CVSS 7.8 Actively exploited

sudo Baron Samedit heap overflow

Disclosed 2021 · Last reviewed 2 Dec 2026

A heap overflow in sudoedit let a local user become root without a password on unpatched sudo.

What happened

sudoedit mishandled an argument that ended in a backslash and overflowed a heap buffer.

Affected and patched versions

Affected
sudo 1.8.2 through 1.8.31p2 and 1.9.0 through 1.9.5p1.
Patched
sudo 1.9.5p2 and later, and the distro packages that backported that fix.

How to check your server

Check

sudo --version

How to fix and harden

  1. Run sudo --version.
  2. Upgrade sudo from the distribution. Upstream 1.9.5p2 contains the fix. Older distro packages may carry the same fix at a lower version number.
  3. Confirm the package changelog names CVE-2021-3156 before you treat a 1.8.x package as safe.

Fix

sudo --version

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON