Skip to main content
7 min read Intermediate Source Code

SAST - Static Application Security Testing

What is Source Code Review?

A secure code review is a line-by-line analysis of the source code of an application, usually performed to find any security risks overlooked during the pre or post-development phase. A secure code review aims to analyze an application's source code and determine whether it has any security vulnerabilities or flaws.

Stay Updated With Official OWASP SAST Guide: https://owasp.org/www-community/Source_Code_Analysis_Tools

Awesome Resources

Assetnote Research Notes : https://www.assetnote.io/resources/research
Sample Fortify Audit Workbench Report : Web-Goat

CreditLink
Cobalt.ioA Pentester's Guide to Source Code Review
Cobalt.ioSource Code Review
@prasad508How to Series: Source Code Review Part 1
codegrip.tech Best Practices for Reviewing Code
YouTube - @HackerVlog Video 1
YouTube - @hackervlogliveVideo 2
YouTube - @HackerVlogVideo 3
OWASPSource Code Analysis Tools
Palo Alto NetworksWhat is SAST - Static Application Security Testing
Mend.ioSAST - Static Application Security Testing
SnykStatic Application Security Testing
SonarSourceSonarSource Security Solutions

Common Tools Free and Paid:

Open Source ToolsSource Code Review Commercial
SonarQube DownloadCheckmarx Static Application Security Testing (SAST)
SemgrepAppScan Source - HCL
SnykFortify
Betterscan-ce Klocwork
VCG - VisualCodeGrepperVeracode
Yasca - Yet Another Source Code Analyzer
Findbugs
RIPS Scanner
OWASP Orizon
LAPSE
FxCOP
RATS
Raptor

Code Review Checklist

Creditshttps://github.com/mgreilerawesomecodereviews.com

List of common Vulnerability

#Vulnerability / RiskTypical Functions / Areas to Inspect
1SQL Injection (SQLi)exec(), query(), mysqli_query(), PDO->query(), dynamic SQL concatenation
2Command Injection / OS Injectionsystem(), exec(), popen(), Runtime.getRuntime().exec(), shell scripts with user input
3Cross-Site Scripting (XSS)innerHTML, document.write(), eval(), template rendering without escaping, React dangerouslySetInnerHTML, Angular ng-bind-html
4Cross-Site Request Forgery (CSRF)Missing anti-CSRF tokens, state-changing requests without verification
5Insecure Deserializationunserialize() (PHP), pickle.load() / marshal.load() (Python), ObjectInputStream.readObject() (Java), YAML.load() (Python/Ruby)
6Remote Code Execution (RCE)eval(), exec(), dynamic imports, unsafe reflection, template engines
7Insecure Direct Object References (IDOR)Direct access to IDs in URLs/APIs without authorization
8Hardcoded Credentials / SecretsPasswords, API keys, tokens, DB credentials, encryption keys in code or config
9Weak or Predictable Randomnessrand(), Math.random(), UUID.randomUUID() without crypto
10Sensitive Data ExposureLogging sensitive info, debug output, URL parameters, cookies, mobile storage
11XML External Entity (XXE)DocumentBuilderFactory, SAXParserFactory, simplexml_load_file(), xml.etree.ElementTree without secure config
12Server-Side Request Forgery (SSRF)file_get_contents(), curl_exec(), HttpClient calls with untrusted input
13File Inclusion / Path Traversalinclude(), require(), fopen(), file_get_contents(), dynamic file paths, user input in filenames
14Insecure File Uploadmove_uploaded_file(), fwrite(), FileOutputStream() without validation, executable uploads allowed
15Insecure Redirects / Open Redirectheader("Location: ..."), response.sendRedirect(), mobile deep links, unvalidated URL parameters
16Broken AuthenticationWeak password policies, missing MFA, insecure password recovery, session hijacking
17Broken Access ControlMissing role/authorization checks, admin functions callable by normal users, tenant segregation issues
18Weak Session ManagementPredictable session IDs, missing expiration, missing rotation, insecure cookie flags
19Insecure CookiesMissing Secure, HttpOnly, SameSite flags, storing sensitive data in cookies/localStorage
20Insecure CryptographyWeak algorithms (MD5, SHA1, DES, RC4, ECB), weak key management, hardcoded keys
21Buffer Overflow / Memory Corruptionstrcpy(), sprintf(), gets(), use-after-free, double free, dangling pointers, C/C++ memory issues
22Integer Overflow / UnderflowArithmetic on unvalidated integers in C/C++ or Java
23Race ConditionsFile access, DB updates, concurrent requests modifying shared resources
24Insecure LoggingLogging sensitive data, log forging/injection, insufficient audit trails
25Missing Security HeadersX-Frame-Options, Content-Security-Policy, X-Content-Type-Options, Strict-Transport-Security, Referrer-Policy, Permissions-Policy
26Insecure API EndpointsMissing authentication/authorization, weak rate limiting, unprotected webhooks, versioning issues
27Weak JWT HandlingMissing signature verification, weak keys, long-lived tokens, missing audience/issuer checks
28Insecure Mobile StorageSharedPreferences, Keychain, SQLite storing secrets unencrypted
29Hardcoded Mobile SecretsAPI keys or tokens in APK/IPA or source code
30Insecure Cloud StorageOpen S3/GCP/Azure buckets, missing ACLs, public read/write
31Unsafe Dynamic Code Execution / Reflectioneval(), Function(), Class.forName(), Method.invoke(), importlib, dynamic imports
32Insecure XML / HTML / Template HandlingTemplate rendering without sanitization, DOM injection, unsafe HTML generation
33Insecure Use of TLS / SSLWeak ciphers, expired/self-signed certificates, missing certificate validation
34Missing Input Validation / SanitizationSQL, OS commands, LDAP, XPath, XML, JSON, regex inputs
35ReDoS / Inefficient RegexComplex regex from untrusted input causing DoS
36Weak Password StoragePlaintext, unsalted hashes, weak PBKDF2 iterations
37Unsafe File / Directory PermissionsWorld-readable/writable files, insecure file ownership
38Unrestricted File OperationsOverwriting/deleting files, unsafe temp files, predictable filenames
39Insecure Compression / Archive HandlingZip bombs, decompression DoS, unsafe file extraction
40Business Logic VulnerabilitiesNegative payments, discount bypass, multi-tenant data leaks, bypassing expected rules
41Insecure Event Handling / Background TasksUnvalidated events, cron jobs processing untrusted input
42Insecure API Rate Limiting / Brute-force ProtectionLogin endpoints, sensitive API calls, scraping prevention
43Missing MFA / Weak Auth FactorsCritical accounts without two-factor authentication
44Insufficient Entropy / Token GenerationWeak CSRF tokens, predictable session tokens, JWT secrets
45Sensitive Data in URLs / GET RequestsTokens, passwords, session IDs in query strings
46Open Database Ports / Weak DB AccessExposed MySQL/PostgreSQL, unsecured DB endpoints
47Missing Error Handling / Info LeakStack traces, verbose errors exposing sensitive info
48Unsafe Use of Temporary / Cache StorageTemp files, CDN cache, Redis/Memcached storing secrets
49Weak OAuth / Access TokensExcessive scopes, missing validation, predictable refresh tokens
50Insecure Use of WebSocketsUnauthenticated WS messages, plain WS without TLS
51Insecure Push Notifications / Mobile APIsSensitive data in notifications, unprotected endpoints
52Insufficient API Pagination / FilteringExposing full datasets without limits or filters
53Unsafe Cross-Origin / CORS ConfigurationAccess-Control-Allow-Origin: *, allowing untrusted origins
54Missing Input Length ChecksBuffer overflows, DoS from long inputs, file uploads
55Unsafe File / Data SerializationDeserialization of untrusted JSON, XML, pickle, marshal, YAML
56Insecure Temporary Credentials / TokensLong expiration, no revocation, predictable tokens
57Insecure Use of Reflection / Dynamic CallsArbitrary method/class execution via reflection without validation
58Missing Audit / MonitoringNo logging of failed logins, sensitive actions, anomalies
59Weak CAPTCHA / Bot ProtectionPredictable or bypassable CAPTCHA on forms
60Insecure Use of Third-Party LibrariesKnown vulnerable versions, deprecated functions, unpatched dependencies
61DOM-based Cross-Site Scripting (DOM XSS)Any DOM manipulation using untrusted input: innerHTML, outerHTML, document.write(), eval(), Function(), setTimeout(string), framework bindings like dangerouslySetInnerHTML, ng-bind-html, or jQuery .html()