Sploitus

Exploit for Code Injection in Gitlab

gitee Β· 2021-12-03

Exploit Code

MARKDOWN16 lines
## https://sploitus.com/exploit?id=2BB60882-1429-5A68-8F77-5BC8A910BD51
The provided code is a Python script that exploits a vulnerability in GitLab CE/EE versions 11.9 and earlier. The vulnerability is related to the way GitLab handles image files, allowing an attacker to execute arbitrary code on the server.

Here's a breakdown of the code:

1. The script starts by importing the necessary libraries, including `requests` and `bs4` (BeautifulSoup).
2. It defines a function `check` that takes a URL as input and checks if the GitLab instance is vulnerable to the exploit.
3. The `check` function sends a GET request to the URL and parses the response using BeautifulSoup.
4. It extracts the CSRF token from the response and uses it to construct a POST request with a malicious image file.
5. The POST request is sent to the GitLab instance, and the script checks if the exploit was successful by looking for a specific response.

The script also includes a `README.md` file that provides more information about the vulnerability and how to use the script.

The vulnerability is related to the way GitLab handles image files, specifically the `image/jpeg` MIME type. The script exploits this vulnerability by sending a malicious image file that contains a payload that is executed on the server.

To use the script, you would need to