Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cve-2021-22205 #34

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

add cve-2021-22205 #34

wants to merge 2 commits into from

Conversation

rucnyz
Copy link

@rucnyz rucnyz commented Nov 20, 2024

I use a sleep(180) to wait the gitlab for setup

Copy link
Collaborator

@olegbck olegbck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fails to run:

2024-11-21 11:41:35,798 - INFO - [ubuntu] Executing 'python /opt/CVE-2021-22205/poc.py http://localhost:8080 "touch /tmp/success"'...
2024-11-21 11:44:38,346 - CRITICAL - [main] Command failed: <UnexpectedExit: cmd='python /opt/CVE-2021-22205/poc.py http://localhost:8080 "touch /tmp/success"' exited=1>

@@ -0,0 +1,6 @@
blueprint: ubuntu2204
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the ubuntu2204-ubuntu2204 blueprint. Install and run the Docker containers on ubuntu1, copy the exploit to ubuntu2, run the exploit on ubuntu2 that would attack ubuntu1. Make sure that router_raw.pcap captures the network traffic. The goal is to get the traffic!

- DB_EXTENSION=pg_trgm,btree_gist

gitlab:
image: vulhub/gitlab:13.10.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please download the Docker image and keep it in the data folder. Install it from the file.


services:
redis:
image: redis:5.0.9-alpine
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this specific version of redis? If we do, then please download the Docker image and keep it in the data folder. Install it from the file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm asking once again: please either download this specific version of redis and install it from file, or pull the latest version of redis.

dest: /opt/CVE-2021-22205/

- name: Start Docker Compose services
command: docker compose up -d --build
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use community.docker.docker_compose instead of shell commands

- python3.11-distutils
state: present

- name: Install pip for Python 3.11
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where pip is used? I don't see that.

ubuntu:
playbook: ubuntu.yml
command:
- "sudo docker ps -a"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove that. Let's keep it clean, without debugging commands.

playbook: ubuntu.yml
command:
- "sudo docker ps -a"
- "python /opt/CVE-2021-22205/poc.py http://localhost:8080 \"touch /tmp/success\""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the new version of cvex.yml based off ubuntu2204-ubuntu2204 please also run ls /tmp/success on ubuntu1. cvex.yml will look like this:

ubuntu2:
...
  command: "python /opt/CVE-2021-22205/poc.py http://localhost:8080 \"touch /tmp/success\""
...
ubuntu1:
...
  command: ls /tmp/success

This way we can verify that the file has been successfully created.

@rucnyz
Copy link
Author

rucnyz commented Dec 7, 2024

Hi Oleg,
I added a second Ubuntu and added a local image. Due to some environmental issues, I spent several hours exploring the community Docker but still failed. I successfully reproduced the exploit locally, as shown in the screenshot.
b8800a7b26cb8f850b72e9200a12830

@rucnyz rucnyz requested a review from olegbck December 7, 2024 01:34
ubuntu2:
playbook: ubuntu2.yml
command:
- "sleep 180"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reliance on sleeps like that is a poor design choice unless there is absolutely no way around it. Is there a way to check that GitLab is ready to be used? Please move this check to ubuntu1.yml.

playbook: ubuntu2.yml
command:
- "sleep 180"
- "python /opt/CVE-2021-22205/poc.py http://ubuntu1:8080 \"touch /tmp/success\""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python does not exist on ubuntu1, therefore this command will always fail to execute. I was able to execute this script with python3:

vagrant@ubuntu2:~$ python3 /opt/CVE-2021-22205/poc.py http://ubuntu1:8080 "touch /tmp/success"
finish test

But then when I execute ls /tmp/success on ubuntu1, it shows me that /tmp/success does not exist. Looks like the exploit doesn't work.


services:
redis:
image: redis:5.0.9-alpine
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm asking once again: please either download this specific version of redis and install it from file, or pull the latest version of redis.

enabled: yes

- name: Verify Docker Compose installation
command: docker compose version
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

command: docker load -i /opt/CVE-2021-22205/gitlab-13.10.1.tar

- name: Start Docker Compose services
command: docker compose up -d --build
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rucnyz
Copy link
Author

rucnyz commented Dec 8, 2024

@olegbck I've noticed that the key to whether the exploit succeeds depends on whether the GitLab service can start normally, and this is quite random - whether it starts within a fixed time and whether it starts correctly are both very difficult to determine. Even worse, I am unable to reproduce this exploit locally now, despite not having made any modifications.

I spent few hours and finally decided to give up and switch to CVE-2012-2122 instead. #42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants