corrode-scanner 0.1.0

Passive web reconnaissance tool for extracting secrets, credentials, and security data
# πŸ¦€ Corrode

**Passive reconnaissance tool for extracting secrets, credentials, and security-relevant data from web applications**

Built with Rust and chromiumoxide for fast, headless scanning. Corrode performs passive analysis onlyβ€”no active exploitation or fuzzing. Use its output to inform manual penetration testing and security assessments.

[![Rust](https://img.shields.io/badge/rust-1.70%2B-orange.svg)](https://www.rust-lang.org/)
[![License: AGPL v3](https://img.shields.io/badge/license-AGPL--3.0-blue.svg)](LICENSE)

## Project Structure

```
src/
β”œβ”€β”€ api/                  # API endpoint discovery (passive extraction from JS)
β”œβ”€β”€ cli.rs                # CLI definitions
β”œβ”€β”€ config.rs             # Config normalization
β”œβ”€β”€ detectors/            # Secrets, DOM, JS (and AST) collectors
β”œβ”€β”€ network/              # Network monitor
β”œβ”€β”€ reporting/            # JSON/Markdown report writers
β”œβ”€β”€ scanner/              # Browser orchestration + workflow
β”œβ”€β”€ types.rs              # Shared data structures
└── main.rs               # Entry point
fixtures/                 # Static fixture pages for local testing
corrode-output/           # Default output directory (per scan)
```

## Architecture

### High-Level Architecture

```mermaid
graph TD
    A[URL Input] --> B[Headless Chrome/Chromium]
    B --> C[Network Monitor]
    B --> D[DOM/Storage Extractor]
    B --> E[Script + AST Scanner]
    E --> G[Secret Scanner]
    D --> H[Tech Fingerprinter]
    C --> I[Security Analysis]
    G --> Results[Reporting JSON + MD]
    C --> Results
    D --> Results
    H --> Results
    I --> Results

    classDef purple fill:#e9d5ff,stroke:#7c3aed,stroke-width:2px,color:#000
    class A,B,C,D,E,F,G,H,I,Results purple
```

### Scanning Workflow

```mermaid
graph TD
    U[User Input] --> CLI[CLI Parser]
    CLI --> B[Headless Browser]
    B --> N[Network Tracking]
    B --> S[HTML/Script Extraction]
    S --> SC[Secret Scanner]
    N --> SEC[Security Analysis]
    SC --> R[Reporter]
    SEC --> R
    N --> R
    R --> OUT[JSON + Markdown Output]

    classDef green fill:#d1fae5,stroke:#059669,stroke-width:2px,color:#000
    class U,CLI,B,N,S,SC,SEC,R,OUT green
```

### Secret Detection Pipeline

```mermaid
graph TD
    S1[HTML Content] --> P[Pattern Matching]
    S2[Inline Scripts] --> P
    S3[External Scripts] --> P
    S4[Hidden Inputs] --> P
    S5[localStorage/sessionStorage] --> P
    S6[Window Objects] --> P
    S7[Cookies] --> P
    P --> D1[Regex Patterns]
    P --> D2[JWT Decoder]
    P --> D3[Base64 Decoder]
    D1 --> R[Extract & Classify]
    D2 --> R
    D3 --> R
    R --> F1[Secret Findings]
    R --> F2[Source Location]
    R --> F3[Severity Level]

    classDef blue fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#000
    class S1,S2,S3,S4,S5,S6,S7,P,D1,D2,D3,R,F1,F2,F3 blue
```

## Features

### Core Scanning Capabilities
- ⚑ **Fast Headless Scanning** - Optimized Chromium workflow for low-latency scans
- πŸ” **Deep Analysis** - Extracts and scans HTML, JavaScript bundles, inline scripts, and external resources
- 🌐 **Network Monitoring** - Tracks all HTTP requests, API calls, and third-party domains
- 🎯 **Pattern Matching** - Detects 30+ types of secrets and credentials
- πŸ“Š **Comprehensive Reporting** - JSON results and detailed Markdown reports per site

### Advanced Analysis
- πŸ” **API Endpoint Discovery** - Extracts API endpoints from JavaScript for manual testing
- πŸ› οΈ **Technology Detection** - Identifies 40+ frameworks, libraries, and services in use
- πŸ”Ž **DOM Analysis** - Analyzes forms, hidden inputs, iframes, meta tags, and data attributes
- πŸͺ **Cookie Security Analysis** - Checks for insecure cookie configurations
- πŸͺŸ **Window Object Inspection** - Extracts sensitive data from window objects (Next.js, Nuxt, etc.)
- πŸ“ **Source Map Detection** - Identifies exposed source maps

## Installation

### Install via Cargo

```bash
cargo install corrode-scanner
```

For local development (from source):
```bash
git clone https://github.com/ul0gic/corrode.git
cd corrode
cargo build --release
./target/release/corrode --url https://example.com
```

### Requirements

| Requirement          | Details                                    |
| -------------------- | ------------------------------------------ |
| Rust                 | 1.70+ (install from [rustup.rs]https://rustup.rs) |
| Chrome/Chromium      | Installed and discoverable; auto-detected, or override with `--chrome-bin`/`CHROME_BIN` |
| OS                   | Linux/macOS                                |

## Usage

### Command Line Options

| Flag / Option        | Description                                                             | Default           | Required |
| -------------------- | ----------------------------------------------------------------------- | ----------------- | -------- |
| `--url <URL>`        | Target URL to scan                                                      | –                 | βœ…       |
| `-o, --output <DIR>` | Output directory (`<output>/<domain>/scan_result.json`, `REPORT.md`)    | `corrode-output`  |          |
| `--chrome-bin <PATH>`| Path to Chrome/Chromium binary (overrides auto-detect)                  | auto-detect       |          |
| `-t, --timeout <s>`  | Page-load timeout in seconds                                            | `30`              |          |
| `-v, --verbose`      | Verbose progress + findings                                             | off               |          |
| `--format <fmt>`     | Output format: `json`, `md`, or `both`                                  | `both`            |          |
| `-h, --help`         | Show help                                                               | –                 |          |
| `-V, --version`      | Show version                                                            | –                 |          |

Chrome/Chromium is auto-detected via PATH and common install locations. Override with `--chrome-bin <path>` or `CHROME_BIN`/`CHROMIUM_BIN` if you have a nonstandard install.

### Usage Examples

- Standard scan:
  ```bash
  ./target/release/corrode --url https://example.com
  ```
- Custom output directory:
  ```bash
  ./target/release/corrode --url https://example.com -o recon-$(date +%Y%m%d)
  ```
- Extended timeout for slow sites:
  ```bash
  ./target/release/corrode --url https://example.com -t 60 -v
  ```
- Explicit Chrome binary override:
  ```bash
  ./target/release/corrode --url https://example.com --chrome-bin "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
  ```

## Detected Secrets & Credentials

Corrode detects 30+ types of secrets and credentials:

### Authentication & Authorization
- πŸ”‘ **JWT Tokens** - Including Supabase service_role detection
- πŸ”‘ **Bearer Tokens** - Authorization header tokens
- πŸ”‘ **Basic Auth** - Base64 encoded credentials
- πŸ” **OAuth Client Secrets** - Google OAuth and others
- πŸ”’ **Private Keys** - RSA, EC, and OpenSSH private keys

### Cloud Providers
- ☁️ **AWS Access Keys** - AKIA keys
- ☁️ **AWS Secret Keys** - Secret access keys
- ☁️ **AWS ARN** - Amazon Resource Names
- πŸ”₯ **Firebase API Keys** - AIza keys
- πŸ—„οΈ **Supabase URLs** - Project URLs
- πŸ—„οΈ **Supabase Anon Keys** - Anonymous keys
- ☁️ **Heroku API Keys** - UUID format keys

### Payment & Financial
- πŸ’³ **Stripe Publishable Keys** - pk_live/pk_test keys
- πŸ’³ **Stripe Secret Keys** - sk_live keys
- πŸ’³ **Stripe Restricted Keys** - rk_live keys

### Communication & Collaboration
- πŸ’¬ **Slack Tokens** - xox tokens
- πŸ’¬ **Slack Webhooks** - Webhook URLs
- πŸ“§ **SendGrid Keys** - SG keys
- πŸ“§ **Mailgun Keys** - API keys
- πŸ“§ **Mailchimp Keys** - API keys
- πŸ“ž **Twilio Keys** - SK keys
- πŸ“ž **Twilio Account SIDs** - AC identifiers

### Version Control & Development
- πŸ™ **GitHub Tokens** - Personal access tokens (classic and fine-grained)
- 🦊 **GitLab Tokens** - Personal access tokens
- πŸ’¬ **Discord Tokens** - Bot and webhook tokens

### Database Connection Strings
- πŸ—„οΈ **PostgreSQL URLs** - Connection strings with credentials
- πŸ—„οΈ **MongoDB URLs** - Connection strings with credentials
- πŸ—„οΈ **MySQL URLs** - Connection strings with credentials
- πŸ—„οΈ **Redis URLs** - Connection strings with credentials

### Other
- 🌐 **Internal IPs** - Private network IP exposure (10.x, 172.16-31.x, 192.168.x)
- πŸ”— **JWT in URLs** - Tokens passed in query parameters
- πŸš€ **Netlify Tokens** - Personal access tokens (nfp_)
- πŸ—„οΈ **Supabase New Keys** - sb_publishable_ and sb_secret_ formats

## Security Issue Detection
- πŸͺ **Insecure Cookies** - Missing Secure, HttpOnly, or SameSite flags
- πŸ” **CORS Misconfiguration** - Detects wildcard Access-Control-Allow-Origin headers
- πŸ›‘οΈ **Missing Security Headers** - CSP, HSTS, X-Frame-Options, X-Content-Type-Options
- πŸ”“ **Mixed Content** - HTTP resources loaded on HTTPS pages
- πŸ› **Debug Mode Detection** - Identifies debug mode enabled in production
- πŸ“ **Source Map Exposure** - Flags exposed source maps that aid reverse engineering
- ⚠️ **CVE-2025-55182** - React Server Components RCE vulnerability detection

### Technology Detection

Corrode automatically identifies 40+ technologies:

**Frameworks**: React, Vue.js, Angular, Svelte, Solid.js, Next.js, Nuxt.js, Remix, Gatsby
**Backend-as-a-Service**: Supabase, Firebase, Appwrite, AWS Cognito
**Authentication**: Auth0, Clerk, Okta
**Payment**: Stripe, PayPal, Square, Braintree
**Analytics**: Google Analytics, Mixpanel, Segment, Amplitude, HubSpot
**CMS**: WordPress, Drupal, Webflow, Contentful, Sanity
**Libraries**: jQuery, Bootstrap, Tailwind CSS, Material-UI
**State Management**: Redux, MobX, Zustand, Apollo Client, Relay

## Roadmap

- [ ] Custom secret pattern definitions via config file
- [ ] HTML report generation
- [ ] Additional CVE detectors

## Disclaimer

**IMPORTANT: For Authorized Security Testing Only**

This tool is designed for legitimate security research, penetration testing, and vulnerability assessment. By using Corrode, you agree to the following:

- βœ… Only scan websites and applications you own or have explicit written permission to test
- βœ… Use this tool for defensive security purposes, security research, and authorized penetration testing
- βœ… Comply with all applicable laws and regulations in your jurisdiction
- βœ… Respect responsible disclosure practices for any vulnerabilities discovered

**We are NOT responsible for:**
- ❌ Any unauthorized scanning or testing of websites without permission
- ❌ Any damage, legal consequences, or violations resulting from misuse of this tool
- ❌ Any actions taken based on the scan results
- ❌ False positives or missed vulnerabilities in scan results

**Legal Notice**: Unauthorized access to computer systems is illegal under laws such as the Computer Fraud and Abuse Act (CFAA) in the United States and similar legislation in other countries. Always obtain proper authorization before testing.

Corrode is provided by **ul0gic** on an "as-is" basis with no warranty. You assume all responsibility for how you use the tool.

## License

Corrode is licensed under the **GNU Affero General Public License v3.0 (AGPL-3.0)**. See `LICENSE` for the complete terms. Highlights:
- βœ… Any modifications or derivative works must remain AGPL and be published when distributed or offered as a hosted service.
- βœ… Keep attribution to **ul0gic** and the Corrode project in downstream forks and hosted deployments.
- βœ… Free for security research, internal assessments, and community contributionsβ€”commercial users simply follow the same AGPL requirements.
- ⚠️ The software is provided without warranty; use it only when you have authorization.

## Contributing

Read `CONTRIBUTING.md` before opening a PR. Key points:
- βœ… All patches are accepted under AGPL-3.0 and you confirm you have the right to contribute the code.
- βœ… Public shoutouts, talks, and demos must credit Corrode and ul0gic.
- βœ… Redistributed builds must keep license headers, this disclaimer, and README attribution intact.

Questions about contributions? Open an issue or ping @ul0gic on GitHub.

## Contact

For questions, issues, or security concerns, please open an issue on GitHub.