Thanks to visit codestin.com
Credit goes to github.com

Skip to content

maycon/TRECO

Repository files navigation

TRECO

TRECO Logo

Tactical Race Exploitation & Concurrency Orchestrator

A specialized framework for identifying and exploiting race condition vulnerabilities in HTTP APIs with sub-microsecond precision.

Python 3.14t License: MIT Free-Threaded Documentation

Documentation | PyPI Package | Quick Start | Examples

Buy Me A Coffee GitHub Sponsor


🎯 Overview

TRECO enables security researchers to orchestrate highly precise concurrent HTTP attacks with sub-microsecond timing accuracy, making it possible to reliably trigger race conditions in web applications. Built for both Python 3.10+ (with GIL) and Python 3.14t (GIL-free), TRECO achieves unprecedented timing precision for race condition exploitation.

Common Vulnerabilities Tested

  • πŸ’° Double-spending attacks - Payment processing vulnerabilities
  • 🎁 Fund redemption exploits - Gift cards and coupon abuse
  • πŸ“¦ Inventory manipulation - Limited stock bypasses
  • πŸ” Privilege escalation - Authentication/authorization flaws
  • ⚑ Rate limiting bypasses - API quota exhaustion
  • 🎟️ Voucher abuse - Single-use code reuse
  • 🏦 TOCTOU vulnerabilities - Time-of-Check to Time-of-Use exploits

✨ Key Features

  • ⚑ Sub-Microsecond Precision: Race windows < 1ΞΌs with barrier synchronization
  • πŸ”“ GIL-Free Option: Python 3.14t for true parallel execution
  • πŸ”„ Flexible Synchronization: Barrier, countdown latch, and semaphore mechanisms
  • 🌐 Full HTTP/HTTPS Support: HTTP/1.1 and HTTP/2 with TLS/SSL
  • 🎨 Powerful Templates: Jinja2-based with TOTP, hashing, env vars, and more
  • 🎯 Dynamic Input Sources: Brute-force, enumeration, and combination attacks
  • πŸ“Š Automatic Analysis: Race window calculation and vulnerability detection
  • πŸ”Œ Extensible Architecture: Plugin-based extractors and connection strategies
  • βœ… JSON Schema Validation: IDE integration and real-time validation

πŸ“¦ Quick Start

Installation

# Install from PyPI
pip install treco-framework

# Or with uv (faster)
uv pip install treco-framework

# Verify installation
treco --version

Your First Test

Create a file test.yaml:

metadata:
  name: "Race Condition Test"
  version: "1.0"
  author: "Security Researcher"
  vulnerability: "CWE-362"

target:
  host: "api.example.com"
  port: 443
  tls:
    enabled: true

entrypoint:
  state: race_attack
  input:
    voucher_code: "DISCOUNT50"

states:
  race_attack:
    description: "Test voucher race condition"
    race:
      threads: 20
      sync_mechanism: barrier
      connection_strategy: preconnect
    
    request: |
      POST /api/vouchers/redeem HTTP/1.1
      Host: {{ target.host }}
      Content-Type: application/json
      
      {"code": "{{ voucher_code }}"}
    
    next:
      - on_status: 200
        goto: end
  
  end:
    description: "Attack completed"

Run the test:

treco test.yaml

πŸ“– Documentation

For detailed documentation, please visit treco.readthedocs.io:


πŸ’‘ Examples

Check out the examples/ directory for real-world attack scenarios:


πŸš€ Why Python 3.14t?

Python 3.14t removes the Global Interpreter Lock (GIL) for true parallelism:

Feature Python 3.10-3.13 (GIL) Python 3.14t (GIL-Free)
True Parallelism ❌ Single thread at a time βœ… Multiple threads simultaneously
Race Window ~10-100ΞΌs < 1ΞΌs (sub-microsecond)
CPU Utilization Limited by GIL Full multi-core usage
Consistency Variable timing Highly consistent
Best for TRECO Good Excellent

Note: TRECO works with both Python 3.10+ and 3.14t, but achieves optimal performance with 3.14t's free-threaded build.

Install Python 3.14t:

uv python install 3.14t
uv pip install treco-framework --python 3.14t

🀝 Contributing

Contributions are welcome! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ’– Support the Project

If you find TRECO useful, please consider supporting its development:

Buy Me A Coffee

GitHub Sponsor

Your support helps maintain and improve TRECO for the security research community.


πŸ“„ License

TRECO is released under the MIT License. See LICENSE for details.

Responsible Use

⚠️ AUTHORIZED TESTING ONLY ⚠️

TRECO is designed for authorized security testing. You must:

  • βœ… Obtain written authorization before testing
  • βœ… Test only within agreed scope and boundaries
  • βœ… Comply with all applicable laws and regulations
  • βœ… Report vulnerabilities responsibly

Unauthorized testing may result in criminal prosecution and civil liability.

Users are solely responsible for ensuring their use complies with applicable laws, regulations, and agreements.


πŸ™ Acknowledgments

  • TREM - The project that inspired TRECO
  • Python Community - For Python 3.14t free-threaded build
  • httpx, Jinja2, PyYAML, PyOTP - Essential libraries
  • Security Community - Researchers and contributors who make this possible

πŸ“ž Support


⚠️ USE RESPONSIBLY - AUTHORIZED TESTING ONLY ⚠️

Made with ❀️ by security researchers, for security researchers

⭐ Star on GitHub | πŸ“– Documentation | πŸ› Report Bug | πŸ’‘ Request Feature

About

Tactical Race Exploitation & Concurrency Orchestrator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages