NullSec CryptoAudit
February 27, 2026 ยท View on GitHub
Cryptographic Implementation Analyzer
A static analysis tool for detecting weak cryptographic implementations written in Scala, demonstrating functional-OOP hybrid patterns for security code analysis.
๐ฏ Overview
NullSec CryptoAudit scans source code to identify weak or deprecated cryptographic algorithms. It detects broken hashes, weak ciphers, insufficient key sizes, and insecure random number generators.
โจ Features
- Hash Analysis - Detect MD5, SHA-1, MD4 usage
- Cipher Detection - Find DES, 3DES, RC4, Blowfish
- Key Size Check - Flag RSA < 2048 bits
- PRNG Analysis - Identify Math.random(), rand()
- CWE Mapping - Common Weakness Enumeration
- MITRE ATT&CK - Technique references
๐ Detection Capabilities
| Algorithm | Type | Status | CWE |
|---|---|---|---|
| MD5 | Hash | Broken | CWE-328 |
| SHA-1 | Hash | Deprecated | CWE-328 |
| DES | Cipher | Broken | CWE-327 |
| 3DES | Cipher | Deprecated | CWE-327 |
| RC4 | Cipher | Broken | CWE-327 |
| RSA-1024 | Asymmetric | Weak | CWE-326 |
| Math.random | PRNG | Weak | CWE-338 |
| PBKDF1 | KDF | Deprecated | CWE-916 |
๐ฆ Installation
# Clone the repository
git clone https://github.com/bad-antics/nullsec-cryptoaudit
cd nullsec-cryptoaudit
# Compile with scalac
scalac CryptoAudit.scala
# Run
scala nullsec.cryptoaudit.CryptoAudit
# Or use Ammonite
amm CryptoAudit.scala
๐ Usage
# Analyze directory
scala CryptoAudit.scala /path/to/code
# Recursive scan
scala CryptoAudit.scala -r project/
# JSON output
scala CryptoAudit.scala -j src/
# Verbose mode
scala CryptoAudit.scala -v app/
# Run demo
scala CryptoAudit.scala
๐ป Example Output
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ NullSec CryptoAudit - Cryptographic Analyzer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[Demo Mode]
Analyzing sample code for weak cryptography...
[CRITICAL] MD5
File: auth.java:45
Code: MessageDigest md = MessageDigest.getInstance("MD5");
Status: Broken
CWE: CWE-328
MITRE: T1110
Fix: Use SHA-256 or SHA-3
[CRITICAL] DES
File: encrypt.js:30
Code: const key = crypto.createCipheriv('des', secret, iv);
Status: Broken
CWE: CWE-327
MITRE: T1573
Fix: Use AES-256
[HIGH] Math.random()
File: random.js:55
Code: const id = Math.random().toString(36);
Status: Weak
CWE: CWE-338
MITRE: T1558
Fix: Use crypto.getRandomValues() or SecureRandom
[MEDIUM] SHA-1
File: crypto.py:120
Code: hash = hashlib.sha1(password.encode())
Status: Deprecated
CWE: CWE-328
MITRE: T1110
Fix: Use SHA-256 or SHA-3
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary:
Files Analyzed: 10
Total Findings: 8
Critical: 4
High: 1
Medium: 3
Low: 0
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Source Code Input โ
โ Java | Python | JavaScript | Go | Ruby โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Pattern Matching Engine โ
โ Regex patterns for crypto functions โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Algorithm Database Lookup โ
โ Status | CWE | MITRE | Recommendation โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Finding Generation โ
โ Severity based on algorithm status โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฏ Scala Features Demonstrated
- Sealed Traits -
Severity,AlgorithmType,AlgorithmStatus - Case Classes - Immutable
Algorithm,Finding,AnalysisResult - Case Objects - Singleton severity levels
- Pattern Matching - Exhaustive match expressions
- For Comprehensions - Monadic composition with Option
- Immutable Collections -
List,Mapoperations - Higher-Order Functions -
flatMap,groupBy,sortBy - String Interpolation -
s"..."for output formatting
๐ง Data Structures
case class Algorithm(
name: String,
algType: AlgorithmType,
status: AlgorithmStatus,
keySize: Option[Int],
cwe: String,
recommendation: String
)
case class Finding(
file: String,
line: Int,
code: String,
algorithm: Algorithm,
severity: Severity,
description: String,
mitre: Option[String]
)
๐ Severity Mapping
| Status | Severity | Description |
|---|---|---|
| Broken | Critical | Cryptographically broken |
| Weak | High | Known vulnerabilities |
| Deprecated | Medium | Should not be used |
| Secure | Info | Acceptable algorithms |
๐ก๏ธ Security Use Cases
- Code Review - Automated crypto weakness detection
- SAST Integration - CI/CD security scanning
- Compliance - Crypto policy enforcement
- Migration Planning - Identify legacy crypto
- Security Auditing - Comprehensive crypto inventory
โ ๏ธ Legal Disclaimer
This tool is intended for:
- โ Authorized code review
- โ Security assessments
- โ Compliance verification
- โ Educational purposes
Only analyze code you're authorized to review.
๐ Links
- Portal: bad-antics.github.io
- Twitter: x.com/AnonAntics
- GitHub: github.com/bad-antics
๐ License
MIT License - See LICENSE file for details.
๐ท๏ธ Version History
- v1.0.0 - Initial release with crypto weakness detection and CWE mapping
Part of the NullSec Security Toolkit