Synology DSM AppArmor synosearchagent misconfiguration vulnerability
The AppArmor profile confining the synosearchagent process on Synology DSM allowed that process to load and remove kernel modules. An attacker who already had code execution as root inside that confined process could load a malicious module to stop AppArmor and gain unrestricted root access.
Originally disclosed on Cisco Talos
A misconfiguration exists in AppArmor’s synosearchagent profile of Synology DSM 6.2.3 25426 DS120j. A specially crafted kernel module can be loaded, leading to a bypass of AppArmor’s restrictions.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the synosearchagent AppArmor profile permitted kernel module loading (insmod) and related operations, which is equivalent to kernel code execution and defeats the confinement.
Impact
An attacker able to execute code as root in the synosearchagent process could escalate to unrestricted root privileges across DSM, but this requires a separate initial compromise such as the earlier synosearchagent issue.
What the attacker needed
Code execution as root in synosearchagent; ability to write a file to disk; local access to the device
The fix
The vendor patched the issue, presumably by tightening the synosearchagent AppArmor profile so it can no longer load kernel modules.
How it was found
- Replace the synosearchagent binary with a shell so it runs under the same AppArmor profile.
- Confirm the profile blocks reading the root directory.
- Load a kernel module from within the confined shell.
- Observe that the module runs and AppArmor is stopped.
- Confirm the root directory is now readable and no profiles are loaded.
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 report has not been written yet. The Original tab links to the source.
AppArmor is a Linux feature that limits what a program is allowed to do, even if it runs as the all-powerful root user. Here the rule set for one Synology program was too loose: it still let the program load extra code into the operating system kernel, which sits above all those limits. Loading such code let the attacker switch AppArmor off entirely.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.