Source Code Review & SAST
Source code review (white-box testing) involves analyzing application source code to identify security vulnerabilities before they reach production. Static Application Security Testing (SAST) automates this process, but manual review by security experts remains essential for complex logic flaws.
White-Box vs Black-Box
Code Review Methodology
1. Reconnaissance
Understand the application architecture, frameworks used, and data flow. Identify entry points and trust boundaries.
2. Automated Scanning
Run SAST tools (SonarQube, Semgrep, CodeQL) to identify low-hanging fruit and focus areas for manual review.
3. Manual Review
Focus on authentication, authorization, input validation, cryptography, and business logic. Trace data flow from untrusted sources.
4. Validation
Attempt to exploit identified vulnerabilities in a test environment to confirm exploitability and impact.
5. Remediation Guidance
Provide developers with secure code examples and specific fixes, not just "vulnerable to XSS".
Common Vulnerability Patterns
Injection Flaws
- • SQL injection (concatenated queries)
- • Command injection (os.system, subprocess)
- • LDAP/NoSQL injection
- • Template injection (Jinja2, Twig)
Authentication/Authorization
- • Hardcoded credentials
- • Weak password policies
- • Missing authorization checks
- • Insecure session management
Cryptography Issues
- • Weak algorithms (MD5, SHA1)
- • Hardcoded encryption keys
- • Insecure random number generation
- • Missing certificate validation
Business Logic Flaws
- • Race conditions
- • Price manipulation
- • Workflow bypasses
- • Insecure deserialization
SAST Tool Comparison
| Tool | Cost | Languages | Best For |
|---|---|---|---|
| SonarQube | Free/Paid | 30+ languages | CI/CD integration, code quality |
| Semgrep | Free (OSS) | 20+ languages | Fast, custom rules, low false positives |
| CodeQL | Free (GitHub) | 10+ languages | Deep analysis, GitHub integration |
| Checkmarx | Commercial | 25+ languages | Enterprise, comprehensive reporting |
Reduce False Positives
Guide Contents
SAST Fundamentals
Introduction to static application security testing methodology.
Manual Code Review
Techniques for manual secure code review and vulnerability identification.
Java/Spring Security
Common vulnerabilities in Java applications and Spring Framework.
C#/.NET Security
Security issues in .NET applications including deserialization.
Python Security
Python-specific vulnerabilities including pickle and SSTI.
JavaScript/Node.js
Client and server-side JavaScript security issues.
Go Security
Security considerations for Go applications.
SAST Tools
Automated static analysis tools and configuration.
Remediation Guidance
Secure coding patterns and fix recommendations.