Source code Review / SAST Tools

Guidance and & Lists of tools

Multi-Language Tools

There is a free package to review PRs.


It's an Open Source tool.

Supported Languages

C# · Go · Java · JavaScript · JSX · JSON · PHP · Python · Ruby · Scala · Terraform · TypeScript · TSX
Kotlin · Rust
Bash · C · C++ · Clojure · Dart · Dockerfile · Elixir · HTML · Julia · Jsonnet · Lisp ·

Quick Start

# Install
brew install semgrep
# Go to your repo code and scan
cd repo
semgrep scan --config auto
You can also use the semgrep VSCode Extension to get the findings inside VSCode.


There is an installable free version.

Quick Start

# Run the paltform in docker
docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest
# Install cli tool
brew install sonar-scanner
# Go to localhost:9000 and login with admin:admin or admin:sonar
# Generate a local project and then a TOKEN for it
# Using the token and from the folder with the repo, scan it
cd path/to/repo
sonar-scanner \
-Dsonar.projectKey=<project-name> \
-Dsonar.sources=. \ \


There is an installable free version but according to the license you can only use free codeQL version in Open Source projects.


# Download your release from
## Example
# Move it to the destination folder
mkdir ~/codeql
mv codeql-bundle* ~/codeql
# Decompress it
cd ~/codeql
tar -xzvf codeql-bundle-*.tar.gz
rm codeql-bundle-*.tar.gz
# Add to path
echo 'export PATH="$PATH:/Users/username/codeql/codeql"' >> ~/.zshrc
# Check it's correctly installed
## Open a new terminal
codeql resolve qlpacks #Get paths to QL packs

Quick Start - Prepare the database

The first thing you need to do is to prepare the database (create the code tree) so later the queries are run over it.
  • You can allow codeql to automatically identify the language of the repo and create the database
codeql database create <database> --language <language>
# Example
codeql database create /path/repo/codeql_db --source-root /path/repo
## DB will be created in /path/repo/codeql_db
This will usually trigger and error saying that more than one language was specified (or automatically detected). Check the next options to fix this!
codeql database create <database> --language <language> --source-root </path/to/repo>
# Example
codeql database create /path/repo/codeql_db --language javascript --source-root /path/repo
## DB will be created in /path/repo/codeql_db
  • If your repo is using more than 1 language, you can also create 1 DB per language indicating each language.
export GITHUB_TOKEN=ghp_32849y23hij4...
codeql database create <database> --source-root /path/to/repo --db-cluster --language "javascript,python"
# Example
export GITHUB_TOKEN=ghp_32849y23hij4...
codeql database create /path/repo/codeql_db --source-root /path/to/repo --db-cluster --language "javascript,python"
## DBs will be created in /path/repo/codeql_db/*
  • You can also allow codeql to identify all the languages for you and create a DB per language. You need to give it a GITHUB_TOKEN.
export GITHUB_TOKEN=ghp_32849y23hij4...
codeql database create <database> --db-cluster --source-root </path/to/repo>
# Example
export GITHUB_TOKEN=ghp_32849y23hij4...
codeql database create /tmp/codeql_db --db-cluster --source-root /path/repo
## DBs will be created in /path/repo/codeql_db/*

Quick Start - Analyze the code

Now it's finally time to analyze the code
Remember that if you used several languages, a DB per language would have been crated in the path you specified.
# Default analysis
codeql database analyze <database> --format=<format> --output=</out/file/path>
# Example
codeql database analyze /tmp/codeql_db/javascript --format=sarif-latest --output=/tmp/graphql_results.sarif
# Specify QL pack to use in the analysis
codeql database analyze <database> \
<qls pack> --sarif-category=<language> \
--sarif-add-baseline-file-info \ --format=<format> \
# Example
codeql database analyze /tmp/codeql_db \
javascript-security-extended --sarif-category=javascript \
--sarif-add-baseline-file-info --format=sarif-latest \

Quick Start - Scripted

export GITHUB_TOKEN=ghp_32849y23hij4...
export REPO_PATH=/path/to/repo
export OUTPUT_DIR_PATH="$REPO_PATH/codeql_results"
mkdir -p "$OUTPUT_DIR_PATH"
export FINAL_MSG="Results available in: "
echo "Creating DB"
codeql database create "$REPO_PATH/codeql_db" --db-cluster --source-root "$REPO_PATH"
for db in `ls "$REPO_PATH/codeql_db"`; do
echo "Analyzing $db"
codeql database analyze "$REPO_PATH/codeql_db/$db" --format=sarif-latest --output="${OUTPUT_DIR_PATH}/$db).sarif"
echo ""
You can visualize the findings in or using VSCode extension SARIF viewer.
You can also use the VSCode extension to get the findings inside VSCode. You will still need to create a database manually, but then you can select any files and click on Right Click -> CodeQL: Run Queries in Selected Files


There is an installable free version.

Quick Start

# Install
sudo npm install -g snyk
# Authenticate (you can use a free account)
snyk auth
# Test for open source vulns & license issues
snyk test [--all-projects]
# Test for code vulnerabilities
## This will upload your code and you need to enable this option in: Settings > Snyk Code
snyk test code
# Test for vulns in images
snyk container test [image]
# Test for IaC vulns
snyk iac test
You can also use the snyk VSCode Extension to get findings inside VSCode.


It's Open Source, but looks unmaintained.

Supported Languages

Java (Maven and Android), Kotlin (Android), Swift (iOS), .NET Full Framework, C#, and Javascript (Node.js).

Quick Start

# Check the correct release for your environment
$ wget
$ tar -xf insider_2.1.0_linux_x86_64.tar.gz
$ chmod +x insider
$ ./insider --tech javascript --target <projectfolder>
Free for public repos.


  • yarn
# Install
brew install yarn
# Run
cd /path/to/repo
yarn audit
npm audit
  • pnpm
# Install
npm install -g pnpm
# Run
cd /path/to/repo
pnpm audit
# Install & run
docker run -it -p 9090:9090 opensecurity/nodejsscan:latest
# Got to localhost:9090
# Upload a zip file with the code
  • RetireJS: The goal of Retire.js is to help you detect the use of JS-library versions with known vulnerabilities.
# Install
npm install -g retire
# Run
cd /path/to/repo
retire --colors


  • electronegativity: It's a tool to identify misconfigurations and security anti-patterns in Electron-based applications.


  • Bandit: Bandit is a tool designed to find common security issues in Python code. To do this Bandit processes each file, builds an AST from it, and runs appropriate plugins against the AST nodes. Once Bandit has finished scanning all the files it generates a report.
# Install
pip3 install bandit
# Run
bandit -r <path to folder>
  • safety: Safety checks Python dependencies for known security vulnerabilities and suggests the proper remediations for vulnerabilities detected. Safety can be run on developer machines, in CI/CD pipelines and on production systems.
# Install
pip install safety
# Run
safety check
  • Pyt: Unmaintained.


# dnSpy
# .NET compilation
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe test.cs


# Install
cargo install cargo-audit
# Run
cargo audit
#Update the Advisory Database
cargo audit fetch


# JD-Gui
# Java compilation step-by-step
javac -source 1.8 -target 1.8
mkdir META-INF
echo "Main-Class: test" > META-INF/MANIFEST.MF
jar cmvf META-INF/MANIFEST.MF test.jar test.class
Execute Jar
java -jar [jar]
Unzip Jar
unzip -d [output directory] [jar]
Create Jar
jar -cmf META-INF/MANIFEST.MF [output jar] *
Base64 SHA256
sha256sum [file] | cut -d' ' -f1 | xxd -r -p | base64
Remove Signing
Delete from Jar
zip -d [jar] [file to remove]
Decompile class
procyon -o . [path to class]
Decompile Jar
procyon -jar [jar] -o [output directory]
Compile class
javac [path to .java file]



Psalm and PHPStan.

Wordpress Plugins




  1. 1.
    • Spider and discover content
    • Sitemap > filter
    • Sitemap > right-click domain > Engagement tools > Find scripts
  2. 2.
    • waybackurls <domain> |grep -i "\.js" |sort -u

Static Analysis



Note: It may not be possible to fully deobfuscate.
  1. 1.
    Find and use .map files:
    • If the .map files are exposed, they can be used to easily deobfuscate.
    • Commonly, maps to foo.js. Manually look for them.
    • Use JS Miner to look for them.
    • Ensure active scan is conducted.
    • Read 'Tips/Notes'
    • If found, use Maximize to deobfuscate.
  2. 2.
    Without .map files, try JSnice:
    • References: &
    • Tips:
      • If using, click on the options button next to the "Nicify JavaScript" button, and de-select "Infer types" to reduce cluttering the code with comments.
      • Ensure you do not leave any empty lines before the script, as it may affect the deobfuscation process and give inaccurate results.
  3. 3.
    Use console.log();
    • Find the return value at the end and change it to console.log(<packerReturnVariable>); so the deobfuscated js is printed instead of being executing.
    • Then, paste the modified (and still obfuscated) js into to see the deobfuscated js logged to the console.
    • Finally, paste the deobfuscated output into to beautify it for analysis.
    • Note: If you are still seeing packed (but different) js, it may be recursively packed. Repeat the process.


Look for:
  • Anti-debug loading
  • Secrets
    • Use:
      • JS Miner
      • RegHex patterns
      • gf patterns
      • Grep relevant dictionary patterns:
        • pass, user, admin
        • auth, login, sign, challenge, 2fa
        • key, apikey, api_key, api-key, jwt, token
        • secret, security, secure
        • ...
      • Manual review
    • If API key found, check here for potential usage syntax:
  • Vuln functions
    • InnerHTML() - If you found this, it means there is a potential chance for XSS if no proper sanitisation takes place. Even if your payload is sanitised, don’t worry. Trace the code to find out where the sanitisation takes place. Study it and try to get around the sanitisation.
    • Postmessage() - If you have read my previous post (, you would notice that Postmessage() might lead to potential CORS issue. If the second parameter of the function set to *, you are the lucky one. Checkout my previous post to understand more about the mechanism behind.
    • - This function looks normal. Why would it be a dangerous function? Well, it is because some developers used this to find occurrence of a string inside another string. However, “.” is treated as wildcard in this function. So, if this function is used as sanitisation check, you can simply bypass it by inputting “.”. Checkout Filedescryptor’s hackerone report:
  • Endpoints & params
  • Vuln libs & deps
    • Use Retire.js and NPM (scroll down to security section > all versions link).
  • Cloud URLs
  • Subdomains
  • Logic Flaws
    • Gain situational awareness:
      • use strict;?
    • Grep for client-side controls:
      • disable, enable, hidden, hide, show
      • catch, finally, throw, try
      • input, validate, verify, valid, correct, check, confirm, require, ..
    • Grep for non-primatives:
      • function , =>
      • class

Dynamic Analysis


Less Used References

Last modified 21d ago