Docker uses privileged mode to escape and obtain host permissions.

0 22
Docker uses privileged mode to escape and obtain host permissions.During the pro...

Docker uses privileged mode to escape and obtain host permissions.

During the process of tracing and countermeasures, one often encounters some interesting methods. Here, I would like to share a method of docker escaping in privileged mode and obtaining host permissions.

Preface

During a process of tracing and countermeasures, a host was found, and after asset collection, several assets were found as follows.

Docker uses privileged mode to escape and obtain host permissions.

1650529826_62611622255c9dfe86c18.jpg!small


Among them, 9000 is a web service, so I visited and checked it out.

It was found to be the Portainer backend, and there was a weak password login.

1650529836_6261162c3114fb745b27a.jpg!small

Generally, when encountering such a login page, people tend to input admin/admin, admin/password, admin/123456. Then, one of them is found to work.


Portainer

Portainer is a graphical management tool for Docker, providing a status display panel, quick deployment of application templates, basic operations of container image network data volumes (including operations such as uploading and downloading images, creating containers, etc.), event log display, container console operations, centralized management and operations of Swarm clusters and services, and login user management and control functions. Its functions are very comprehensive and can basically meet all the needs of container management for small and medium-sized units.

This is the first time I encountered this background in the tracing process, and I briefly browsed through it

The background looks like this 1650529845_62611635c00b0bb0eb578.jpg!small

There are many pre-created Docker containers here. You can also download custom images and build containers


Utilize

I thought that if I added the --privileged parameter (privileged mode) to the Docker container startup, I could use disk mounting. After mounting, I can replace local host files, such as writing a public key to getshell. Thinking of this, I clicked to create a new container. I selected the nginx:latest image

1650529855_6261163f5705554eee7e8.jpg!small

Note that you must check the following option to enable privileged mode

1650529865_6261164915b163b88b87c.jpg!small

After checking this option, the privileged mode will be enabled.

1650529873_62611651c0cecfbd6bdbf.jpg!small

After creating the container, click here to enter the container console.

Now we need to mount the disk to the container's directory. This is different from the container data volume settings, as this step is a real disk mount.

View the disk using the df -h command, create a folder /abcd, and then mount the host machine's filesystem onto the /abcd directory within the Docker container.

1650529880_62611658ea2b6d314a5c8.jpg!small

Then, the /abcd directory is the actual host file of the host machine, and we normally write the public key file under root.

1650529888_62611660069b01a664f86.jpg!small


You can directly log in via ssh after that

1650529897_626116694353dc1c7a259.jpg!small


Summary

This is a real situation I encountered in the process of tracing and counteracting. As a cautionary tale, if you are deploying a Docker environment yourself, please do not use the privileged mode!

你可能想看:

0x02 Abusing SeBackupPrivilege permission to perform NTDS.dt shadow copy for privilege escalation

0x07 Abuse of SeBackupPrivilege and SeRestorePrivilege permissions

APP Illegal Trend: Interpreting the 'Identification Method for Illegal and Unauthorized Collection and Use of Personal Information by APPs'

In today's rapidly developing digital economy, data has become an important engine driving social progress and enterprise development. From being initially regarded as part of intangible assets to now

It is possible to perform credible verification on the system boot program, system program, important configuration parameters, and application programs of computing devices based on a credible root,

Announcement regarding the addition of 7 units as technical support units for the Ministry of Industry and Information Technology's mobile Internet APP product security vulnerability database

Ensure that the ID can be accessed even if it is guessed or cannot be tampered with; the scenario is common in resource convenience and unauthorized vulnerability scenarios. I have found many vulnerab

2.1. Obtain the password of the optical network terminal super administrator account (telecomadmin)

In-depth Analysis and Practice: Analysis of Apache Commons SCXML Remote Code Execution Vulnerability and POC EXP Construction

5. Collect exercise results The main person in charge reviews the exercise results, sorts out the separated exercise issues, and allows the red and blue sides to improve as soon as possible. The main

最后修改时间:
admin
上一篇 2025年03月28日 14:02
下一篇 2025年03月28日 14:25

评论已关闭