Performing Cryptographic Audit of Application
Overview
A cryptographic audit systematically reviews an application's use of cryptographic primitives, protocols, and key management to identify vulnerabilities such as weak algorithms, insecure modes, hardcoded keys, insufficient entropy, and protocol misconfigurations. This skill covers building an automated crypto audit tool that scans Python and configuration files for common cryptographic weaknesses.
When to Use
Trigger phrases:
"performing cryptographic audit of application"
"A cryptographic audit systematically reviews an application's use of cryptograph"
When conducting security assessments that involve performing cryptographic audit of application
When following incident response procedures for related security events
When performing scheduled security testing or auditing activities
When validating security controls through hands-on testing
Prerequisites
- Familiarity with cryptography concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Objectives
- Detect usage of deprecated algorithms (MD5, SHA-1, DES, RC4)
- Identify insecure cipher modes (ECB) and padding schemes
- Find hardcoded keys, passwords, and secrets in source code
- Verify TLS/SSL configuration strength
- Check key derivation function parameters
- Validate random number generator usage
- Produce a structured audit report with findings and remediation
Key Concepts
This section covers key concepts for performing cryptographic audit of application.
- Ensure all prerequisites are met before proceeding
- Follow the documented workflow steps in sequence
- Record results and any anomalies encountered during this phase
Cryptographic Weakness Categories
| Category |
Examples |
Risk Level |
| Weak Hashing |
MD5, SHA-1 for integrity/signatures |
High |
| Insecure Encryption |
DES, 3DES, RC4, Blowfish |
High |
| Bad Cipher Mode |
ECB mode for any block cipher |
High |
| Insufficient Key Size |
RSA < 2048, AES-128 for long-term |
Medium |
| Hardcoded Secrets |
Keys/passwords in source code |
Critical |
| Weak KDF |
Low iteration PBKDF2, plain MD5 |
High |
| Poor Entropy |
time-based seeds, predictable IVs |
High |
| Deprecated Protocols |
SSLv3, TLS 1.0, TLS 1.1 |
High |
Security Considerations
- Review both application code and configuration files
- Check third-party dependencies for known crypto vulnerabilities
- Verify certificates and TLS configurations on deployed servers
- Ensure secrets are loaded from environment variables or vaults
- Review key storage and rotation practices
Validation Criteria
When NOT to Use
- You don't have explicit written authorization to test
- Task is about defense/detection, not offense (use detection skills)
- You need to implement security controls (use implementing-* skills)
- Task requires compliance auditing (use auditing-* skills)
- You're investigating an incident (use incident response skills)
- Target is out of scope for your engagement
- Task is about vulnerability scanning only (use scanning tools)
Red Flags
- Performing actions without explicit written authorization from the asset owner
- Testing against production systems without a defined scope and rules of engagement
- Treating compliance checklists as security guarantees rather than minimum baselines
- Failing to document exceptions and risk acceptance decisions
- Relying on point-in-time audits instead of continuous monitoring
Verification
- All steps executed successfully against a test environment before production use
- Output documented with screenshots or logs demonstrating expected behavior
- Results validated against known-good baselines or reference implementations
- Documentation complete enough for another analyst to reproduce findings
Process
# Example: IOC detection
import re
IOC_PATTERNS = {
"ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",
"hash_md5": r"\b[a-f0-9]{32}\b",
"hash_sha256": r"\b[a-f0-9]{64}\b",
}
def extract_iocs(text: str) -> dict:
return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}
- Analyze the task requirements
- Apply domain expertise
- Verify output quality
Anti-Rationalization Table
| Rationalization |
Reality |
| "We are too small to be targeted" |
Automated attacks target everyone. Size does not matter. |
| "Security slows us down" |
A breach slows you down 100x more. Build security in from the start. |
| "We will fix it after launch" |
Vulnerabilities in production are exploited within hours. Fix before deploy. |
1---2name: performing-cryptographic-audit-of-application3description: Use when a cryptographic audit systematically reviews an application's4 use of cryptographic primitives, protocols, and key management to identify vulnerabilities5 such as weak algorithms, insecure modes, hardco. Use when working with performing6 cryptographic audit of application.7domain: cybersecurity8subdomain: cryptography9tags:10- cryptography11- audit12- security-review13- compliance14- vulnerability-assessment15version: '1.0'16author: oyi7717license: Apache-2.018nist_csf:19- PR.DS-0120- PR.DS-0221- PR.DS-1022category: cybersecurity23metadata:24 source: https://skillmd.com/skills/oyi77/performing-cryptographic-audit-of-application25---2627# Performing Cryptographic Audit of Application2829## Overview3031A cryptographic audit systematically reviews an application's use of cryptographic primitives, protocols, and key management to identify vulnerabilities such as weak algorithms, insecure modes, hardcoded keys, insufficient entropy, and protocol misconfigurations. This skill covers building an automated crypto audit tool that scans Python and configuration files for common cryptographic weaknesses.323334## When to Use35**Trigger phrases:**36- "performing cryptographic audit of application"37- "A cryptographic audit systematically reviews an application's use of cryptograph"383940- When conducting security assessments that involve performing cryptographic audit of application41- When following incident response procedures for related security events42- When performing scheduled security testing or auditing activities43- When validating security controls through hands-on testing4445## Prerequisites4647- Familiarity with cryptography concepts and tools48- Access to a test or lab environment for safe execution49- Python 3.8+ with required dependencies installed50- Appropriate authorization for any testing activities5152## Objectives5354- Detect usage of deprecated algorithms (MD5, SHA-1, DES, RC4)55- Identify insecure cipher modes (ECB) and padding schemes56- Find hardcoded keys, passwords, and secrets in source code57- Verify TLS/SSL configuration strength58- Check key derivation function parameters59- Validate random number generator usage60- Produce a structured audit report with findings and remediation6162## Key Concepts6364This section covers key concepts for performing cryptographic audit of application.6566- Ensure all prerequisites are met before proceeding67- Follow the documented workflow steps in sequence68- Record results and any anomalies encountered during this phase69### Cryptographic Weakness Categories7071| Category | Examples | Risk Level |72|----------|----------|------------|73| Weak Hashing | MD5, SHA-1 for integrity/signatures | High |74| Insecure Encryption | DES, 3DES, RC4, Blowfish | High |75| Bad Cipher Mode | ECB mode for any block cipher | High |76| Insufficient Key Size | RSA < 2048, AES-128 for long-term | Medium |77| Hardcoded Secrets | Keys/passwords in source code | Critical |78| Weak KDF | Low iteration PBKDF2, plain MD5 | High |79| Poor Entropy | time-based seeds, predictable IVs | High |80| Deprecated Protocols | SSLv3, TLS 1.0, TLS 1.1 | High |8182## Security Considerations8384- Review both application code and configuration files85- Check third-party dependencies for known crypto vulnerabilities86- Verify certificates and TLS configurations on deployed servers87- Ensure secrets are loaded from environment variables or vaults88- Review key storage and rotation practices8990## Validation Criteria9192- [ ] Scanner detects all injected test weaknesses93- [ ] MD5/SHA-1 usage for security purposes is flagged94- [ ] ECB mode usage is flagged95- [ ] Hardcoded keys/passwords are detected96- [ ] Weak KDF parameters are identified97- [ ] Report includes severity, location, and remediation98- [ ] False positive rate is below 10%99## When NOT to Use100101- You don't have explicit written authorization to test102- Task is about defense/detection, not offense (use detection skills)103- You need to implement security controls (use implementing-* skills)104- Task requires compliance auditing (use auditing-* skills)105- You're investigating an incident (use incident response skills)106- Target is out of scope for your engagement107- Task is about vulnerability scanning only (use scanning tools)108109110## Red Flags111112- Performing actions without explicit written authorization from the asset owner113- Testing against production systems without a defined scope and rules of engagement114- Treating compliance checklists as security guarantees rather than minimum baselines115- Failing to document exceptions and risk acceptance decisions116- Relying on point-in-time audits instead of continuous monitoring117## Verification118119- All steps executed successfully against a test environment before production use120- Output documented with screenshots or logs demonstrating expected behavior121- Results validated against known-good baselines or reference implementations122- Documentation complete enough for another analyst to reproduce findings123124## Process125126```python127# Example: IOC detection128import re129130IOC_PATTERNS = {131 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",132 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",133 "hash_md5": r"\b[a-f0-9]{32}\b",134 "hash_sha256": r"\b[a-f0-9]{64}\b",135}136137def extract_iocs(text: str) -> dict:138 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}139```1401411. Analyze the task requirements1422. Apply domain expertise1433. Verify output quality144145## Anti-Rationalization Table146147| Rationalization | Reality |148|---|---|149| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |150| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |151| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |