-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Improve how we fingerprint Gitlab versions #18723
Conversation
Totally out of scope; it'd be cool to have a auxiliary gitlab version module maybe? 🤔 |
So a self-contained module like |
Would certainly make testing easier as well |
I added a |
Awesome 👍 I'll just cross-reference #18120 here too |
# | ||
# @return [String,nil] Gitlab version if found, nil otherwise | ||
def gitlab_version | ||
version = gitlab_version_css(normalize_uri(target_uri.path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these methods for grabbing the version be reordered to have the most detailed response at the top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ordered them from the least invasive to the most invasive, but I'm open to suggestions wrt. what we want to prioritize.
It seems that msf6 auxiliary(scanner/http/gitlab_version) > set RHOSTS gitlab.torproject.org
RHOSTS => gitlab.torproject.org
msf6 auxiliary(scanner/http/gitlab_version) > run
[*] Error: 2a01:4f8:fff0:4f:266:37ff:feb8:3489: Msf::Exploit::Remote::HTTP::Gitlab::Error::VersionError Unable to determine Gitlab version
[*] Scanned 1 of 2 hosts (50% complete)
[*] Error: 116.202.120.180: Msf::Exploit::Remote::HTTP::Gitlab::Error::VersionError Unable to determine Gitlab version
[*] Scanned 2 of 2 hosts (100% complete)
[*] Auxiliary module execution completed
msf6 auxiliary(scanner/http/gitlab_version) > set RHOSTS https://gitlab.torproject.org/tpo/team
RHOSTS => https://gitlab.torproject.org/tpo/team
msf6 auxiliary(scanner/http/gitlab_version) > run
[+] Gitlab version for 2a01:4f8:fff0:4f:266:37ff:feb8:3489: 16.9.1
[*] Scanned 1 of 2 hosts (50% complete)
[+] Gitlab version for 116.202.120.180: 16.9.1
[*] Scanned 2 of 2 hosts (100% complete)
[*] Auxiliary module execution completed
msf6 auxiliary(scanner/http/gitlab_version) > |
Hey @jvoisin, I ran this slightly edited script multiple times while incrementing the page id to collect enterprise versions.
Here's the data it collected. If you wouldn't mind sorting the ranges like you did with the community versions and pushing the additions to this PR that would be much appreciated! Thank you!! Gitlab Enterprise Edition Version Hashes
|
Since I was the one suggesting it in #18716, I kinda volunteered to implement it. This improvement is based on [Censys's blogpost](https://censys.com/cve-2021-22205-it-was-a-gitlab-smash/) on the topic, making use of the `/assets/application-….css` files that have a unique name per gitlab versions. The fingerprints were acquired with this bash script: ```bash assetdir="/opt/gitlab/embedded/service/gitlab-rails/public/assets" tags=$(curl "https://hub.docker.com/v2/repositories/gitlab/gitlab-ce/tags?page_size=100" | jq -r '.results[].name') for tag in $tags; do filename=$(docker run --quiet --rm -it --entrypoint "" gitlab/gitlab-ce:$tag ls $assetdir|egrep '^application-.*\.css' | grep -v \.gz | cut -d' ' -f1) echo $tag,$filename done ``` Co-authored-by: cgranleese-r7 <[email protected]>
Co-authored-by: jheysel-r7 <[email protected]>
Testing the most recent changes: Range where low and high versions are the same
Range where low and high versions are different
|
aea95c0
Release NotesA webpage exists that can be reached without authentication that contains a hash that can be used to determine the approximate version of gitlab running on the endpoint. This PR enhances our current GitLab fingerprinting capabilities to include the aforementioned technique. |
Since I was the one suggesting it in #18716, I kinda volunteered to implement it. This improvement is based on Censys's blogpost on the topic, making use of the
/assets/application-….css
files that have a unique name per gitlab versions. This behaviour is known to gitlab.The fingerprints were acquired with this bash script:
Moreover, gitlab is leaking its commit hash in a javascript variable, so we can use this as well, as a last resort, since it's less convenient for the users.