Skip to content

�� Phantom - Zero-Knowledge Proof Security Framework. Prove vulnerabilities without revealing details. Julia.

Notifications You must be signed in to change notification settings

bad-antics/phantom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

👻 Phantom

Zero-Knowledge Proof Security Framework

Prove vulnerabilities exist without revealing how to exploit them.

Julia License Security


🎯 Overview

Phantom is a revolutionary Julia framework that enables security researchers to:

  • Prove vulnerability existence without revealing exploit details
  • Anonymous disclosure with cryptographic guarantees
  • Time-locked reveals for coordinated disclosure
  • Immutable audit trails for accountability
  • Blockchain anchoring for timestamping proofs

The Problem

Traditional vulnerability disclosure creates a dilemma:

  • Reveal details → Attackers exploit before patch
  • Keep secret → Vendors may ignore
  • Partial disclosure → Insufficient proof

The Solution

Phantom uses Zero-Knowledge Proofs to create cryptographic attestations that:

  1. ✅ Prove you found a real vulnerability
  2. ✅ Prove its severity level
  3. ✅ Prove you have a working exploit
  4. ❌ WITHOUT revealing how to exploit it

🚀 Quick Start

Installation

using Pkg
Pkg.add(url="https://github.com/yourusername/Phantom.jl")

Basic Usage

using Phantom

# Create a vulnerability commitment
details = VulnerabilityDetails(
    title = "SQL Injection in Login",
    description = "Authentication bypass via malicious input",
    affected_systems = ["api.example.com"],
    severity = VULN_CRITICAL,
    vuln_type = TYPE_INJECTION,
    proof_of_concept = "' OR '1'='1",
    steps_to_reproduce = ["Navigate to login", "Enter payload", "Access granted"]
)

# Create commitment (hashes details without revealing)
commitment = create_vulnerability_commitment(details)

# Generate ZK proof of severity
severity_proof = generate_severity_proof(
    commitment,
    VULN_CRITICAL,
    VULN_HIGH  # Proves severity >= HIGH
)

# Verify proof (anyone can verify without seeing details)
is_valid = verify_severity_proof(severity_proof, VULN_HIGH)
# Returns: true (proves severity is at least HIGH)

📚 Core Concepts

1. Vulnerability Commitments

A commitment cryptographically binds to vulnerability details without revealing them:

# Commitment structure
struct VulnerabilityCommitment
    severity_commitment     # H(severity || nonce)
    type_commitment        # H(type || nonce)  
    description_commitment # H(description || nonce)
    proof_commitment       # H(proof_of_concept || nonce)
    metadata_hash          # H(all_metadata)
end

Properties:

  • Binding: Cannot change details after commitment
  • Hiding: Cannot determine details from commitment
  • Verifiable: Can prove properties without revealing

2. Zero-Knowledge Proofs

Phantom supports multiple proof types:

# Prove severity without revealing exact level
severity_proof = generate_severity_proof(commitment, actual_severity, threshold)

# Prove discovery before a date
timeline_proof = generate_timeline_proof(commitment, discovery_date)

# Prove working exploit exists
exploit_proof = generate_exploitability_proof(commitment, has_poc=true)

# Combine multiple claims
composite = create_composite_proof([
    severity_proof,
    timeline_proof,
    exploit_proof
])

3. Anonymous Reporting

Report vulnerabilities without revealing your identity:

# Generate anonymous keypair
keypair = generate_schnorr_keypair()

# Create ring of authorized reporters (e.g., verified researchers)
authorized_ring = [researcher1.public_key, researcher2.public_key, ...]

# Create anonymous report
report = create_anonymous_report(
    commitment,
    keypair,
    authorized_ring
)

# Report proves membership without revealing which researcher you are

4. Staged Disclosure

Control information release over time:

# Define disclosure policy
policy = DisclosurePolicy(
    name = "90-day-standard",
    vendor_notify_delay = Day(0),      # Immediate vendor notification
    partial_disclosure_delay = Day(45), # Partial details at 45 days
    full_disclosure_delay = Day(90)     # Full disclosure at 90 days
)

# Create staged disclosure
disclosure = create_staged_disclosure(policy, commitment, details)

# Advance through stages
advance_disclosure!(disclosure)  # To VENDOR_NOTIFIED
advance_disclosure!(disclosure)  # To PARTIAL_DISCLOSURE (reveals type)
advance_disclosure!(disclosure)  # To FULL_DISCLOSURE (reveals all)

🔐 Cryptographic Primitives

Elliptic Curves

Phantom uses BN254 (alt_bn128) for efficient pairing operations:

# Field arithmetic
a = FieldElement(123456789)
b = FieldElement(987654321)
c = a + b  # Modular addition
d = a * b  # Modular multiplication

# Curve operations
P = G1_GENERATOR
Q = scalar * P  # Scalar multiplication

Commitment Schemes

# Pedersen commitments (homomorphic)
params = generate_pedersen_params()
commitment = pedersen_commit(params, value, nonce)

# Hash commitments
commitment = hash_commit(data)

# Vector commitments (Merkle-based)
vc = create_vector_commitment(items)
proof = generate_membership_proof(vc, index)

Signature Schemes

# Schnorr signatures
keypair = generate_schnorr_keypair()
signature = schnorr_sign(keypair, message)
valid = schnorr_verify(keypair.public_key, message, signature)

# Ring signatures (anonymous)
ring_sig = ring_sign(my_key, ring_of_public_keys, message)
valid = ring_verify(ring_of_public_keys, message, ring_sig)

# Blind signatures
blinded = blind_message(message, blinding_factor)
blind_sig = blind_sign(signer_key, blinded)
signature = unblind_signature(blind_sig, blinding_factor)

📊 Audit System

Cryptographic Audit Trails

Every action creates an immutable audit entry:

# Create audit trail
trail = create_audit_trail()

# Log events
add_audit_event!(trail, AUDIT_COMMITMENT_CREATED, commitment.id, details)
add_audit_event!(trail, AUDIT_PROOF_GENERATED, proof.id, details)

# Verify integrity
result = verify_audit_trail(trail)
println("Valid: ", result.valid)
println("Errors: ", result.errors)

Blockchain Anchoring

Anchor proofs to public blockchains for timestamping:

# Configure blockchain
config = ethereum_config(
    "https://mainnet.infura.io/v3/YOUR_KEY",
    timestamp_contract = "0x..."
)

# Anchor proof
anchor = anchor_to_ethereum(config, proof.commitment.metadata_hash)

# Verify anchor
is_valid = verify_ethereum_anchor(config, anchor)

🌐 API Integration

REST API Client

# Configure API
api_config = PhantomAPIConfig(
    base_url = "https://api.phantom.security",
    api_version = "v1",
    auth_method = :api_key,
    api_key = "your_key"
)

# Submit proof
response = submit_proof(api_config, proof)

# Verify remotely
status = verify_proof_remote(api_config, proof.id)

🔒 Security Considerations

Threat Model

Phantom protects against:

  • ✅ Information leakage before authorized disclosure
  • ✅ Reporter identity exposure
  • ✅ Proof forgery
  • ✅ Timeline manipulation
  • ✅ Audit trail tampering

Phantom does NOT protect against:

  • ❌ Side-channel attacks during proof generation
  • ❌ Malicious trusted setup (use MPC setup)
  • ❌ Quantum computers (use post-quantum upgrades)

Best Practices

  1. Generate fresh nonces for every commitment
  2. Use hardware security modules for key storage
  3. Verify proofs client-side before trusting
  4. Anchor important proofs to multiple blockchains
  5. Keep details encrypted until disclosure time

📁 Module Structure

Phantom/
├── src/
│   ├── Phantom.jl              # Main module
│   ├── crypto/
│   │   ├── primitives.jl       # Field/curve arithmetic
│   │   ├── commitments.jl      # Commitment schemes
│   │   ├── zksnark.jl          # ZK-SNARK proofs
│   │   └── signatures.jl       # Signature schemes
│   ├── core/
│   │   ├── vulnerability.jl    # Vulnerability structures
│   │   ├── proof.jl            # Proof generation
│   │   └── disclosure.jl       # Disclosure policies
│   ├── anonymous/
│   │   ├── reporter.jl         # Anonymous reporting
│   │   └── mixer.jl            # Transaction mixing
│   ├── audit/
│   │   ├── trail.jl            # Audit trails
│   │   └── verification.jl     # Audit verification
│   ├── integration/
│   │   ├── api.jl              # REST API
│   │   └── blockchain.jl       # Blockchain anchoring
│   └── utils/
│       ├── helpers.jl          # Utility functions
│       └── serialization.jl    # Serialization
└── test/
    └── runtests.jl

🎓 Use Cases

Bug Bounty Programs

  1. Researcher finds vulnerability
  2. Creates commitment and proof
  3. Submits anonymous report with proof
  4. Vendor verifies proof is valid
  5. Researcher claims bounty anonymously

Coordinated Disclosure

  1. Multiple researchers find same bug
  2. Each creates commitment
  3. Proofs show same vulnerability without revealing
  4. Coordinate disclosure timeline
  5. Release in synchronized manner

Whistleblower Protection

  1. Create protected disclosure with dead man's switch
  2. Encrypt details for escrow parties
  3. If whistleblower goes silent, disclosure triggers
  4. Full anonymity throughout process

🤝 Contributing

Contributions welcome! Areas of interest:

  • Post-quantum ZK proof schemes
  • Additional blockchain integrations
  • Formal verification of circuits
  • Performance optimizations
  • Additional commitment schemes

📄 License

MIT License - see LICENSE for details.


🙏 Acknowledgments

  • BN254 curve implementation inspired by ethereum/py_pairing
  • ZK-SNARK design based on Groth16
  • Ring signatures based on CryptoNote

Built with 👻 for the security research community

About

�� Phantom - Zero-Knowledge Proof Security Framework. Prove vulnerabilities without revealing details. Julia.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages