Skip to main content

Discourse forum security scanner. Written for security professionals and forum administrators.

Project description

๐Ÿ›ก๏ธ DiscourseMap

DiscourseMap Python Ruby License Status

Comprehensive security testing framework for Discourse forums

Features โ€ข Installation โ€ข Usage โ€ข Modules โ€ข Contributing

๐Ÿ“‹ Overview

DiscourseMap is a comprehensive, modular security testing framework specifically designed for Discourse forum platforms. It combines Python-based scanning modules with Ruby exploit integration to provide thorough security assessments covering everything from basic information gathering to advanced vulnerability exploitation.

๐ŸŽฏ Key Highlights

  • 25+ Security Modules covering all aspects of Discourse security
  • Ruby Exploit Integration with 25+ CVE-specific exploits
  • Modular Architecture for easy extension and customization
  • Comprehensive Coverage from reconnaissance to exploitation
  • Professional Reporting with detailed findings and recommendations
  • Active Development with regular updates and new features

๐Ÿš€ Features

๐Ÿ” Core Security Testing

Category Description Modules
Information Gathering Reconnaissance and fingerprinting Info, Endpoint, User
Vulnerability Assessment Core security testing Vulnerability, CVE Exploits
Authentication & Authorization Access control testing Auth, Session Management
Configuration Security Misconfigurations and hardening Config, Network
Cryptographic Analysis Crypto implementation testing Crypto, SSL/TLS
Plugin & Theme Security Extension security testing Plugin, Theme Analysis

๐Ÿ› ๏ธ Advanced Capabilities

  • Multi-Vector Testing: Combines automated scanning with manual exploit techniques
  • CVE Database: Integrated database of Discourse-specific vulnerabilities
  • Custom Payloads: Sophisticated payload generation and testing
  • Evasion Techniques: Advanced methods to bypass security controls
  • Real-time Analysis: Live vulnerability detection and exploitation
  • Detailed Reporting: Comprehensive reports with remediation guidance

๐Ÿ“ฆ Installation

๐Ÿš€ Quick Install (Recommended)

# Install from PyPI - Simple and fast!
pip install discoursemap

# Verify installation
discoursemap --help

# Start scanning immediately
discoursemap -u https://forum.example.com

๐Ÿ“ฆ Alternative Installation Methods

# Install with pipx for isolated environment
pipx install discoursemap

# Install specific version
pip install discoursemap==1.1.0

# Upgrade to latest version
pip install --upgrade discoursemap

Prerequisites

# System Requirements
- Python 3.8 or higher
- Ruby 2.7 or higher
- Git
- Internet connection for dependency installation

๐Ÿ”ง Manual Installation

# Clone the repository
git clone https://github.com/ibrahmsql/discoursemap.git
cd discoursemap

# Install Python dependencies
pip3 install -r requirements.txt

# Install Ruby dependencies
bundle install

# Make scripts executable
chmod +x discoursemap/scanner.py
chmod +x ruby_exploit_runner.rb

# Verify installation
python3 discoursemap/scanner.py --help

Docker Installation

# Build Docker image
docker build -t discoursemap .

# Run scanner with Docker
docker run --rm -v $(pwd)/reports:/app/reports discoursemap \
  python3 main.py -u https://target-forum.com --modules info

# Using Docker Compose
docker-compose build
docker-compose run --rm discoursemap \
  python3 main.py -u https://target-forum.com --modules info,vuln

# Interactive mode
docker run -it --rm discoursemap bash

Development Setup

# Install development dependencies
pip3 install -r requirements-dev.txt

# Install pre-commit hooks
pre-commit install

# Run tests
python3 -m pytest tests/

๐ŸŽฏ Usage

Basic Scanning

# Basic security scan
python3 discoursemap/scanner.py -u https://discourse.example.com

# Scan with specific modules
python3 discoursemap/scanner.py -u https://discourse.example.com -m info,vulnerability,auth

# Aggressive scan with all modules
python3 discoursemap/scanner.py -u https://discourse.example.com --aggressive

# Scan with custom output
python3 discoursemap/scanner.py -u https://discourse.example.com -o results.json

Advanced Options

# Scan with authentication
python3 discoursemap/scanner.py -u https://discourse.example.com \
  --username admin --password secretpass

# Scan with proxy
python3 discoursemap/scanner.py -u https://discourse.example.com \
  --proxy http://127.0.0.1:8080

# Scan with custom headers
python3 discoursemap/scanner.py -u https://discourse.example.com \
  --headers "X-Forwarded-For: 127.0.0.1" "User-Agent: CustomBot/1.0"

# Stealth mode with delays
python3 discoursemap/scanner.py -u https://discourse.example.com \
  --delay 2 --random-delay

Ruby Exploit Integration

# Run specific CVE exploits
python3 discoursemap/modules/cve_exploit_module.py \
  --target https://discourse.example.com \
  --cve CVE-2021-41163

# Run all Ruby exploits
ruby ruby_exploit_runner.rb https://discourse.example.com

# Run exploits with custom parameters
ruby ruby_exploit_runner.rb https://discourse.example.com \
  --timeout 30 --threads 5

๐Ÿงฉ Modules

๐Ÿ” Information Gathering

Info Module (info_module.py)

  • Server Information: Version detection, technology stack
  • Configuration Discovery: Settings, features, plugins
  • User Enumeration: Active users, administrators, moderators
  • Content Analysis: Categories, topics, sensitive information

Endpoint Module (endpoint_module.py)

  • Directory Discovery: Hidden paths, admin panels, API endpoints
  • File Discovery: Backup files, configuration files, logs
  • API Enumeration: REST endpoints, GraphQL schemas
  • Subdomain Discovery: Related domains and services

๐Ÿ›ก๏ธ Security Testing

Vulnerability Module (vulnerability_module.py)

  • Injection Attacks: SQL, NoSQL, LDAP, Command injection
  • Cross-Site Scripting: Reflected, Stored, DOM-based XSS
  • Cross-Site Request Forgery: CSRF token analysis
  • Server-Side Request Forgery: SSRF testing
  • XML External Entity: XXE vulnerability testing
  • Insecure Deserialization: Object injection attacks

Auth Module (auth_module.py)

  • Authentication Bypass: Login bypass techniques
  • Privilege Escalation: Horizontal and vertical escalation
  • Session Management: Session fixation, hijacking
  • Password Policy: Weak password detection
  • Account Lockout: Brute force protection testing
  • OAuth/SSO Security: Third-party authentication flaws

๐Ÿ” Cryptographic Security

Crypto Module (crypto_module.py)

  • Weak Hashing: MD5, SHA1 detection
  • Weak Encryption: DES, RC4, ECB mode detection
  • JWT Vulnerabilities: Algorithm confusion, weak secrets
  • Session Security: Cookie analysis, CSRF tokens
  • Key Exposure: Private key leakage
  • Timing Attacks: Cryptographic timing vulnerabilities

๐ŸŒ Network & Infrastructure

Network Module (network_module.py)

  • Port Scanning: Service discovery
  • SSL/TLS Analysis: Certificate validation, cipher analysis
  • DNS Analysis: Zone transfers, subdomain enumeration
  • CDN Detection: Content delivery network analysis
  • Firewall Detection: Security control identification
  • Load Balancer Analysis: Infrastructure mapping

Config Module (config_module.py)

  • Configuration Files: Exposed settings, backups
  • Debug Information: Error messages, stack traces
  • Security Headers: HSTS, CSP, X-Frame-Options
  • CORS Misconfiguration: Cross-origin policy flaws
  • Default Credentials: Common username/password combinations
  • Environment Variables: Sensitive data exposure

๐Ÿ”Œ Plugin & Theme Security

Plugin Module (plugin_module.py)

  • Plugin Discovery: Installed plugins and themes
  • Vulnerability Testing: Plugin-specific security flaws
  • Outdated Components: Version analysis
  • Dangerous Permissions: Excessive privileges
  • File Access: Unauthorized file operations
  • Theme Injection: Template injection vulnerabilities

๐ŸŽฏ User & Content Security

User Module (user_module.py)

  • User Enumeration: Username discovery techniques
  • Profile Analysis: Sensitive information exposure
  • Permission Testing: Access control verification
  • Social Engineering: Information gathering
  • Account Takeover: Session and credential attacks

๐Ÿ”ฅ Ruby Exploit Collection

Critical CVEs (CVSS 9.0+)

CVE Description CVSS Module
CVE-2019-11479 SQL Injection in search 9.8 CVE-2019-11479.rb
CVE-2021-41163 RCE via theme import 9.8 CVE-2021-41163.rb
CVE-2023-49103 Admin panel auth bypass 9.1 CVE-2023-49103.rb
CVE-2024-28084 File upload RCE 9.8 CVE-2024-28084.rb
CVE-2024-42364 SQL injection via search 9.3 CVE-2024-42364.rb

High Severity (CVSS 7.0-8.9)

CVE Description CVSS Module
CVE-2022-31053 SSRF via onebox preview 8.6 CVE-2022-31053.rb
CVE-2024-35198 Server-side template injection 8.8 CVE-2024-35198.rb
CVE-2023-37467 CSP nonce reuse XSS 7.5 discourse_cve_exploits.rb

General Vulnerability Categories

  • XSS Exploits (discourse_xss.rb) - Multiple XSS vectors
  • SSRF Exploits (discourse_ssrf.rb) - Server-side request forgery
  • RCE Exploits (discourse_rce.rb) - Remote code execution
  • SQL Injection (discourse_sqli.rb) - Database injection attacks
  • Auth Bypass (discourse_auth_bypass.rb) - Authentication bypass
  • File Upload (discourse_file_upload.rb) - File upload vulnerabilities
  • Info Disclosure (discourse_info_disclosure.rb) - Information leakage
  • CSRF Attacks (discourse_csrf.rb) - Cross-site request forgery
  • XXE Attacks (discourse_xxe.rb) - XML external entity
  • Plugin Exploits (discourse_plugin_exploits.rb) - Plugin vulnerabilities

๐Ÿ“Š Sample Output

๐Ÿ›ก๏ธ  DiscourseMap v2.0
๐ŸŽฏ Target: https://discourse.example.com
โฐ Started: 2024-12-20 10:30:15

[INFO] Starting comprehensive security scan...
[INFO] Modules loaded: info, endpoint, vulnerability, auth, crypto

๐Ÿ“‹ Information Gathering
โ”œโ”€โ”€ [โœ“] Server: Discourse 3.1.2 (Ruby 3.0.4)
โ”œโ”€โ”€ [โœ“] Plugins: 12 installed (3 outdated)
โ”œโ”€โ”€ [โš ๏ธ] Admin users: 2 discovered
โ””โ”€โ”€ [โœ“] Categories: 15 public, 3 restricted

๐Ÿ” Endpoint Discovery
โ”œโ”€โ”€ [โœ“] Admin panel: /admin (protected)
โ”œโ”€โ”€ [โš ๏ธ] Debug endpoint: /debug (exposed)
โ”œโ”€โ”€ [โœ“] API endpoints: 45 discovered
โ””โ”€โ”€ [โŒ] Backup files: config.bak found

๐Ÿ›ก๏ธ Vulnerability Assessment
โ”œโ”€โ”€ [โŒ] SQL Injection: 2 vulnerabilities found
โ”œโ”€โ”€ [โš ๏ธ] XSS: 1 stored XSS in user profiles
โ”œโ”€โ”€ [โŒ] CSRF: Missing tokens on 3 endpoints
โ””โ”€โ”€ [โœ“] File upload: Properly restricted

๐Ÿ” Authentication & Authorization
โ”œโ”€โ”€ [โŒ] Default credentials: admin/admin works
โ”œโ”€โ”€ [โš ๏ธ] Session management: No timeout configured
โ”œโ”€โ”€ [โœ“] Password policy: Strong requirements
โ””โ”€โ”€ [โŒ] Privilege escalation: Role manipulation possible

๐Ÿ”’ Cryptographic Security
โ”œโ”€โ”€ [โš ๏ธ] Weak hashing: MD5 found in password reset
โ”œโ”€โ”€ [โœ“] SSL/TLS: Properly configured
โ”œโ”€โ”€ [โŒ] JWT: Algorithm confusion vulnerability
โ””โ”€โ”€ [โš ๏ธ] Session cookies: Missing secure flag

๐Ÿ“ˆ Scan Summary
โ”œโ”€โ”€ ๐Ÿ”ด Critical: 3 vulnerabilities
โ”œโ”€โ”€ ๐ŸŸก High: 5 vulnerabilities  
โ”œโ”€โ”€ ๐ŸŸ  Medium: 8 vulnerabilities
โ””โ”€โ”€ ๐ŸŸข Low: 12 vulnerabilities

๐Ÿ’พ Report saved: discourse_scan_20241220_103015.json
โฑ๏ธ  Scan completed in 4m 32s

๐Ÿ“‹ Configuration

Configuration File (config.yaml)

# DiscourseMap Configuration

# Target Configuration
target:
  url: "https://discourse.example.com"
  timeout: 30
  retries: 3
  verify_ssl: true

# Authentication
auth:
  username: ""
  password: ""
  api_key: ""
  session_cookie: ""

# Scanning Options
scan:
  modules:
    - info
    - endpoint
    - vulnerability
    - auth
    - crypto
    - network
    - config
    - plugin
    - user
  
  aggressive: false
  delay: 1
  random_delay: true
  threads: 5

# Proxy Configuration
proxy:
  http: ""
  https: ""
  socks: ""

# Output Configuration
output:
  format: "json"  # json, xml, html, pdf
  file: "scan_results.json"
  verbose: true
  colors: true

# Ruby Exploit Configuration
ruby_exploits:
  enabled: true
  timeout: 60
  max_threads: 3
  cve_filter: []  # Empty = all CVEs

# Reporting
reporting:
  include_screenshots: false
  include_payloads: true
  risk_scoring: true
  compliance_mapping: true

Environment Variables

# Set environment variables for sensitive data
export DISCOURSE_USERNAME="admin"
export DISCOURSE_PASSWORD="secretpass"
export DISCOURSE_API_KEY="your-api-key"
export PROXY_URL="http://127.0.0.1:8080"

๐Ÿ”ง Development

Project Structure

discoursemap/
โ”œโ”€โ”€ discoursemap/
โ”‚   โ”œโ”€โ”€ modules/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ info_module.py
โ”‚   โ”‚   โ”œโ”€โ”€ endpoint_module.py
โ”‚   โ”‚   โ”œโ”€โ”€ vulnerability_module.py
โ”‚   โ”‚   โ”œโ”€โ”€ auth_module.py
โ”‚   โ”‚   โ”œโ”€โ”€ crypto_module.py
โ”‚   โ”‚   โ”œโ”€โ”€ network_module.py
โ”‚   โ”‚   โ”œโ”€โ”€ config_module.py
โ”‚   โ”‚   โ”œโ”€โ”€ plugin_module.py
โ”‚   โ”‚   โ”œโ”€โ”€ user_module.py
โ”‚   โ”‚   โ”œโ”€โ”€ cve_exploit_module.py
โ”‚   โ”‚   โ””โ”€โ”€ utils.py
โ”‚   โ””โ”€โ”€ scanner.py
โ”œโ”€โ”€ ruby_exploits/
โ”‚   โ”œโ”€โ”€ CVE-2019-11479.rb
โ”‚   โ”œโ”€โ”€ CVE-2021-41163.rb
โ”‚   โ”œโ”€โ”€ CVE-2022-31053.rb
โ”‚   โ”œโ”€โ”€ CVE-2023-49103.rb
โ”‚   โ”œโ”€โ”€ CVE-2024-28084.rb
โ”‚   โ”œโ”€โ”€ CVE-2024-35198.rb
โ”‚   โ”œโ”€โ”€ CVE-2024-42364.rb
โ”‚   โ”œโ”€โ”€ discourse_xss.rb
โ”‚   โ”œโ”€โ”€ discourse_ssrf.rb
โ”‚   โ”œโ”€โ”€ discourse_rce.rb
โ”‚   โ”œโ”€โ”€ discourse_sqli.rb
โ”‚   โ”œโ”€โ”€ discourse_auth_bypass.rb
โ”‚   โ”œโ”€โ”€ discourse_file_upload.rb
โ”‚   โ”œโ”€โ”€ discourse_info_disclosure.rb
โ”‚   โ”œโ”€โ”€ discourse_csrf.rb
โ”‚   โ”œโ”€โ”€ discourse_xxe.rb
โ”‚   โ”œโ”€โ”€ discourse_plugin_exploits.rb
โ”‚   โ”œโ”€โ”€ discourse_cve_exploits.rb
โ”‚   โ”œโ”€โ”€ discourse_file_upload_exploits.rb
โ”‚   โ”œโ”€โ”€ discourse_api_exploits.rb
โ”‚   โ””โ”€โ”€ discourse_privilege_escalation.rb
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ test_modules.py
โ”‚   โ”œโ”€โ”€ test_exploits.py
โ”‚   โ””โ”€โ”€ test_integration.py
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ API.md
โ”‚   โ”œโ”€โ”€ MODULES.md
โ”‚   โ””โ”€โ”€ EXPLOITS.md
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ requirements-dev.txt
โ”œโ”€โ”€ Gemfile
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ config.yaml.example
โ”œโ”€โ”€ TODO.md
โ””โ”€โ”€ README.md

Adding New Modules

# Example: Creating a new module
class CustomModule:
    def __init__(self, scanner):
        self.scanner = scanner
        self.results = {
            'module_name': 'Custom Security Testing',
            'target': scanner.target_url,
            'vulnerabilities': []
        }
    
    def run_scan(self):
        """Main scanning logic"""
        print(f"[*] Running custom security tests...")
        
        # Your testing logic here
        self._test_custom_vulnerability()
        
        return self.results
    
    def _test_custom_vulnerability(self):
        """Test for custom vulnerability"""
        # Implementation here
        pass

Adding Ruby Exploits

# Example: Creating a new Ruby exploit
class CustomExploit
  def initialize(target_url)
    @target_url = target_url
    @results = []
  end
  
  def run_exploit
    puts "[*] Testing custom vulnerability..."
    
    # Your exploit logic here
    test_custom_vulnerability
    
    @results
  end
  
  private
  
  def test_custom_vulnerability
    # Implementation here
  end
end

๐Ÿงช Testing

Running Tests

# Run all tests
python3 -m pytest tests/ -v

# Run specific test categories
python3 -m pytest tests/test_modules.py -v
python3 -m pytest tests/test_exploits.py -v

# Run with coverage
python3 -m pytest tests/ --cov=discoursemap --cov-report=html

# Run integration tests
python3 -m pytest tests/test_integration.py -v --slow

Test Environment Setup

# Set up test Discourse instance
docker run -d --name discourse-test \
  -p 8080:80 \
  discourse/discourse:latest

# Run tests against test instance
python3 discoursemap/scanner.py -u http://localhost:8080 --test-mode

๐Ÿ“š Documentation

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick Start for Contributors

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

Areas for Contribution

  • ๐Ÿ› Bug fixes and improvements
  • ๐Ÿš€ New security modules and tests
  • ๐Ÿ’Ž Ruby exploit modules for new CVEs
  • ๐Ÿ“š Documentation improvements
  • ๐Ÿงช Test coverage expansion
  • ๐ŸŽจ UI/UX enhancements
  • ๐Ÿ”ง Performance optimizations

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

โš ๏ธ Disclaimer

IMPORTANT: This tool is for educational and authorized security testing purposes only. Users are responsible for ensuring they have proper authorization before testing any systems. The developers assume no liability for misuse of this tool.

Responsible Use Guidelines

  • โœ… Only test systems you own or have explicit permission to test
  • โœ… Follow responsible disclosure practices
  • โœ… Respect rate limits and avoid DoS conditions
  • โœ… Use in compliance with local laws and regulations
  • โŒ Do not use for malicious purposes
  • โŒ Do not test systems without authorization

๐Ÿ™ Acknowledgments

  • Discourse Team for creating an amazing platform
  • Security Researchers who discovered and reported vulnerabilities
  • Open Source Community for tools and libraries used
  • Contributors who help improve this project

๐Ÿ“ž Support & Contact


Made with โค๏ธ by ฤฐbrahimsql

GitHub stars GitHub forks GitHub issues GitHub pull requests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discoursemap-1.0.1.tar.gz (312.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

discoursemap-1.0.1-py3-none-any.whl (230.2 kB view details)

Uploaded Python 3

File details

Details for the file discoursemap-1.0.1.tar.gz.

File metadata

  • Download URL: discoursemap-1.0.1.tar.gz
  • Upload date:
  • Size: 312.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for discoursemap-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8e114b49c1b022ca74fb9754b2a9fd54552f2ec210d76c224047e1b8c3c63e57
MD5 5ac31eb1aae36f6b96d64c6edc7e5936
BLAKE2b-256 ff78505546ea3041277391d49cdc4179ab580b23e2ebf91826885528aeddae67

See more details on using hashes here.

File details

Details for the file discoursemap-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: discoursemap-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 230.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for discoursemap-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 430e17063e5a356a938d639ca191314c0a5ef0d953853fba224dc13b8dd9eed0
MD5 d258f94087d2521764542cf538580fc4
BLAKE2b-256 8c24bc70db5afe036de3274fd0ad650ba27e0119a071c324a94c6f772793130a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page