Skip to main content

Privilege Escalation through Docker group membership and… sudo backdoor?

Illustration of Privilege Escalation through Docker group membership and… sudo backdoor?
Dominik Antończak

Maintaining robust access controls is a fundamental aspect of secure system administration, particularly when dealing with privileged user groups and containerization technologies.

Introduction

During a security audit, a high-risk vulnerability was discovered in an environment where a user named “securitum_insider_user” held membership in the docker group. This membership, combined with specific misconfigurations in the operating system, allowed for privilege escalation to root-level access. Once root privileges were obtained, I deployed a custom script that captured sudo passwords from unsuspecting users on the same host. Although no sensitive information was ultimately retrieved beyond those credentials, this demonstrates how even seemingly small permission oversights can compromise an entire system.

The vulnerability assessment revealed that Docker’s elevated capabilities were insufficiently implemented, enabling the insider to launch a privileged container and then pivot into the host’s filesystem. While containerization solutions like Docker typically provide logical isolation, misconfiguration or overbroad group privileges can undermine those measures. In addition to container exploitation, the malicious actor could configure a sudo backdoor that recorded passwords by acting as a legitimate binary. This was successful enough to extract multiple users’ credentials without detection, underscoring the critical need for stricter access control, thorough monitoring, and robust intrusion detection practices.

Discovery of Docker-enabled Privilege Escalation

The reconnaissance indicated that “securitum_insider_user” was part of the docker group, a configuration that often permits users to interact with the Docker daemon at a level functionally equivalent to root. The presence of Docker typically suggests a more modular development environment; however, one of the most overlooked aspects is how container technology can pierce isolation boundaries if it is not correctly confined. When a standard user has the ability to launch privileged containers, the pivot to host-level root access can be an easy way. The summary of the environment revealed that the only prerequisite for this attack was membership in the docker group. By investigating group allocations and confirming Docker’s default permissions, the auditor established that “securitum_insider_user” held effective control over container creation. This immediately raised concerns about the potential for using Docker to map host directories directly into a container, thereby granting root-level access to the mentioned filesystem.

Technical Details and Proof of Concept

A demonstration of the privilege escalation was conducted to validate the suspicion that Docker permissions could be used maliciously. I first enumerated user and group IDs to confirm group membership:

User and group enumeration

With the docker group confirmed, the auditor launched a privileged container, mounting the host’s root directory inside the container:

Privileged container launch

This sequence successfully transitioned the auditor to a root shell on the host system, bypassing ordinary user restrictions. From there, standard administrative commands and file explorations were possible. One instant outcome was accessing the /etc/shadow file, which contained password hashes for all system users:

Shadow file access

A brute force attack targeting the hashes was executed, eventually cracking the password for “empusertwo”. While further enumeration did not yield additional credentials from this route, the incident demonstrated how a low-complexity or non-compliant password policy could invite higher-value compromise.

Deployment of SUDO backdoor

Having gained elevated privileges, the malicious insider could create a sudo backdoor aimed at capturing passwords. I accomplished this by editing /etc/bash.bashrc - a file invoked for system-wide shell sessions - to insert a malicious alias:

Sudo backdoor deployment

The script (script.sh) behaved as a passthrough to the legitimate sudo binary, but it also captured users credentials by encrypting them with a public key. Over several days of normal host usage, unsuspecting users typed their sudo passwords, resulting in multiple encrypted files placed in /home/securitum_insider_user/extraction_point/:

Encrypted credential files

Once moved to the tester’s own machine, the insider decrypted them:

Credential decryption

Although none of these harvested credentials granted further access to remote services such as GitLab or additional SSH endpoints, the successful capture of credentials demonstrated the broad potential damage of an insider threat operating with elevated permissions.

Eventually, the backdoor script was removed from the host, but not before it had submitted insight into the systemic vulnerabilities and user credential hygiene.

Conclusion

This audit shows the dangers of relying on default configurations in systems involving containerization. Docker is a powerful platform, but granting users membership in the docker group can grant root access if proper isolation techniques are not employed. Further, the ability to embed backdoor scripts reveals that once an attacker achieves privileged access, they can exploit seemingly routine environment configurations to harvest even more credentials. Although no additional critical data was ultimately obtained in this instance, the unauthorized collection of sudo passwords illustrates a security weakness that could be leveraged under different circumstances for more extensive infiltration.

Refined access control policies, stronger password rules, and rigorous monitoring of system-level configuration scripts can significantly mitigate these risks and preserve organizational integrity.

Other Insights

Illustration of Two-Step Exploit: From Initial Request to Complete Admin Takeover

Two-Step Exploit: From Initial Request to Complete Admin Takeover

Mateusz Lewczak

During a penetration test of a desktop application's backend interface, a critical flaw was identified that allows unauthenticated users to execute SQL queries by sending specially crafted requests. Although the backend was intended to restrict unauthenticated queries to simple SELECT statements on a specific configuration table, the actual implementation failed to properly validate the structure and scope of those queries. As a result, it is possible to use SQL injection techniques, specifically the UNION operator to extract sensitive data from unrelated tables in the database.

READ article
Illustration of Remote Configuration Disclosure and Code Execution in a Legacy TYPO3 Instance

Remote Configuration Disclosure and Code Execution in a Legacy TYPO3 Instance

Dariusz Tytko

During an external penetration test I identified a critical vulnerability that grants unauthenticated users full visibility of the application side configuration and a direct path to server side code execution. The target site operates on TYPO3 CMS version 6.2.31, a release line that addresses some patches, including the security bulletin referenced as typo3 psa 2020 001. Because the instance still exposes the auxiliary validateHash controller, any visitor can request a Hash based Message Authentication Code for an arbitrary value. TYPO3 relies on that to protect form metadata sent from client to server, once an attacker can mint valid HMACs, every integrity barrier collapses. The following sections reproduce the proof of concept chronology performed during the audit.

READ article
A professional cybersecurity consultant ready to assist with your inquiry.

Any questions?

Happy to get a call or email
and help!