flawopen.com/安全事件/Baron Samedit

Baron Samedit:隐藏在一个反斜杠后长达十年的 Linux Root 提权后门

High — Local privilege escalation CWE-787: Out-of-bounds Write Disclosed 26 January 2021
通俗解释 (ELI5)

公文审核员有一条铁律:遇到反斜杠转义符,就必须把后面的那个字符原样抄下来。有人故意递交了一份以反斜杠结尾的申请表。审核员在纸面上找不到下一个字符,不仅没有停止,反而笔尖直接划出纸张边缘,抄到桌面底下的绝密档案堆上,将档案上的'禁止进入'涂改成了'放行'。

That second point is the durable engineering lesson. The unescaping function was correct given its assumed precondition. The vulnerability lived in the gap between a documented assumption and an unusual call path that violated it. Preconditions enforced by convention rather than by code fail silently, and they fail years later, when whoever knew the convention has moved on.

Why a local bug matters as much as a remote one

Privilege escalation flaws are sometimes discounted because they require existing access. That reasoning misreads how intrusions work. Attackers routinely obtain low-privilege access first — a compromised web application process, a stolen SSH key for an unprivileged account, a container breakout, a malicious dependency running in CI. A reliable local root exploit converts that foothold into total control of the host.

In shared environments the effect compounds: on a multi-user build server or a shell host, this bug meant every user was effectively root.

The lessons that actually transfer

FAQ

Did I need to be in the sudoers file?

No. That is what made this unusually severe — the overflow occurred during argument processing, before any authorisation decision. Users with no sudo rights whatsoever could exploit it.

Would a memory-safe language have prevented it?

This specific failure mode, yes — a bounds-checked language would panic or throw rather than write out of bounds, turning a root exploit into a crash. The logic error of mishandling a trailing escape could still exist; its consequences would be far less severe.

Related reading

参考资料与权威通告