Berildocs GitHub

Defend

Artifact scans

beril scan works on files and folders as well as URLs. It is static and read-only. Nothing is installed, executed, or uploaded.

./beril scan --target ./build/app.apk
./beril scan --target ./source --tools --vibe
./beril scan --target ./bin/service
./beril scan --target ./release/app.exe
./beril scan --target ./plugins --jar
./beril secrets --target ./source --history
./beril deps --target ./source --reachability
./beril sbom --target ./source --out sbom.cdx.json --spdx sbom.spdx.json

The scanner detects the type and runs the matching checks. Use it on an artifact you own or are authorized to review.

What each type checks#

TypeChecks
Source treeMasked secrets and history, 25 source rules, dangerous sinks, debug flags, CI permissions, container settings, public cloud resources, lockfiles, dependency and OSV match, fan-in
APKManifest flags, exported components, permissions, debug certificate, cleartext, backup, native ABIs, embedded strings and secrets
IPAInfo.plist, ATS, URL schemes, frameworks, embedded strings and secrets
PE / EXE / DLLASLR, DEP, CFG, code signature, section entropy, RWX sections, suspicious imports, packer markers, secrets
ELFPIE, NX, RELRO, canary, RPATH, SUID, imports, embedded URLs, secrets
JARplugin.yml, IOC files, class strings, external URLs, Base64, nested archives, obfuscation, hash
ArchivePath traversal, symlinks, huge entries, nested artifacts, secrets in text entries

Findings use critical to info. The score is a rough triage number, not CVSS.

Source review#

Point the scanner at the repository root.

./beril scan --target ./source --tools

The built-in pass looks for:

  • cloud keys, private keys, database URLs, tokens, and generic secret assignments, all masked;
  • eval, exec, pickle, unserialize, innerHTML, child_process, and similar sinks;
  • DEBUG=True, wildcard allowed hosts, wildcard CORS, disabled TLS checks;
  • pull_request_target, write-all, unpinned actions;
  • FROM ...:latest, remote scripts piped to a shell, privileged containers;
  • public S3 ACLs, 0.0.0.0/0, public databases;
  • a tracked .env and missing lockfiles;
  • missing create policy after create table, client-side service_role, public secret prefixes;
  • vulnerable dependency versions, with an import reachability filter.

--tools adds semgrep and gitleaks when they are installed. --vibe adds the Supabase and client-secret checks. --sbom writes a component list.

Secret handling order: revoke first, rotate, deploy, then clean history. Full guide: docs/secrets.md.

Triage tips:

  1. A hit in a test fixture or a documentation example is usually noise.
  2. Confirm a secret with a read-only API call before reporting it.
  3. Follow a sink to the source of its input. A hit without a data flow is a hint.
  4. Check whether the debug flag applies to production config, not only to settings/dev.py.

APK review#

./beril scan --target ./app-release.apk

The scanner reads the binary manifest and reports:

  • debuggable builds and old target SDKs;
  • exported activities, services, receivers, and providers;
  • dangerous permissions;
  • allowBackup and cleartext traffic;
  • debug signing certificates;
  • native ABIs and embedded URLs or secrets.

An exported component is not automatically a bug. Confirm that it accepts input from another app and that the input reaches something sensitive. Main launcher activities are usually exported by design.

For deeper work:

apktool d app.apk -o app-src
jadx-gui app.apk
apksigner verify --print-certs app.apk

Then read the manifest by hand. The scanner cannot follow a deep link into a vulnerable handler.

IPA review#

./beril scan --target ./app.ipa

Checks include App Transport Security exceptions, URL schemes, frameworks, and strings in plists and bundles. A broad NSAllowsArbitraryLoads is a lead, not a finding. Confirm which domains actually use HTTP.

For runtime work use a jailbroken device or a corellium-style lab with Frida and objection.

PE review#

./beril scan --target ./app.exe

The scanner reports missing ASLR, DEP, CFG, signatures, high entropy sections, RWX sections, and suspicious imports. A missing signature matters for distribution, not always for exploitation.

Useful follow-ups:

objdump -p app.exe | head -80
strings -n 8 app.exe | grep -Ei "http|cmd|powershell|token"

For a deep reverse, load the binary in Ghidra or r2 -A.

ELF review#

./beril scan --target ./bin/service

The scanner reports PIE, NX, RELRO, canary, RPATH, SUID, imports, and embedded URLs. A missing canary matters only when a stack buffer is reachable from input.

Follow-ups:

checksec --file=./bin/service
readelf -hW ./bin/service
readelf -lW ./bin/service | grep GNU_STACK
nm -D ./bin/service

JAR and Minecraft plugin review#

./beril jar --target ./plugins
./beril jar --target ./FreeRank.jar

Checks the manifest, plugin.yml name and version, IOC file names such as plugin-config.bin, class strings for process and class loading, external URLs, Base64 blocks, nested archives, obfuscation ratio and timestamps. The hash is always printed for comparison.

A behavior string is not guilt. Open the class in a decompiler:

cfr FreeRank.jar --outputdir out

Then follow the call chain to a URL or a setOp. Known aile markers: plugin-config.bin and hidden .data files.

Archive review#

./beril scan --target ./release.zip

Checks for ../ entries, absolute paths, symlinks, very large entries, nested apps, and secrets in text files. A traversal entry matters when the extraction tool follows it and a service later reads the extracted path.

Optional tools#

pip install semgrep
go install github.com/zricethezav/gitleaks/v8@latest
go install github.com/aquasecurity/trivy/cmd/trivy@latest
sudo apt install apktool jadx
pip install frida-tools objection

./install.sh --tools installs gitleaks, trivy, and semgrep along with the recon tools.

The scanner merges semgrep and gitleaks results as tool entries. Trivy is installed for manual image or filesystem runs. Treat all of them as leads. A SAST rule can fire on safe code, and a dependency CVE needs a reachability check.

Reading the output#

scans/app-release.md
scans/app-release.json

The Markdown groups findings by severity and gives evidence and advice. The JSON is for a pipeline.

SeverityTypical action
CriticalLive secret, debug signing on a release, public bucket with data
HighExported service without permission, no ASLR, tracked .env
MediumDebuggable build, missing RELRO, cleartext allowed
LowMissing lockfile, unpinned base image
InfoPermission, technology, or context worth knowing

Limits#

  • Nothing is executed, so packers, dynamic loading, and runtime permissions are invisible.
  • Obfuscated strings need a real reverse-engineering session.
  • Pattern matches can flag placeholders such as AKIAIOSFODNN7EXAMPLE; the context filter lowers them but does not remove them.
  • Source scan skips node_modules, vendor, dist, build, .venv, and similar directories.
  • Large files are sampled, not fully read.
  • A clean result is not a certification.

Safety#

Static analysis does not touch the network. --tools may run local binaries only. If a source tree contains a huge dependency folder, the default file cap keeps the scan bounded.

Authorization still applies. A local copy does not grant the right to test the running service.