Skip to main content

Kashif · كاشِف — vulnscan

English | العربية  ·  Website  ·  Download

Kashif (vulnscan) — open-source SAST with real dataflow analysis

Kashif (كاشِف, "the revealer") is a dependency-free static application security testing tool written in Python. kashif is the name of the command (vulnscan, its earlier name and the Python package's, still works as an alias). It scans source code, archives, Android apps and (passively) websites, and produces a report ordered from critical to info, from the command line or from a local web UI in English and Arabic.

Dashboard Finding with its data-flow trace
Kashif dashboard A SQL injection finding with its source-to-sink trace

Authorization first: scan only what you own or are authorized in writing to test. Scanning other people's systems without permission may be illegal. Web targets require the --authorized flag.

What it does

  • Dataflow (taint) analysis in 12 languages — Python, JavaScript/TypeScript, Java, Kotlin, C#, Go, PHP, C/C++, Rust, Swift, Ruby and PL/SQL. Untrusted input is tracked across functions, classes and files, and every finding carries the full source → sink path.
  • Precision features — flow-sensitive analysis with constant folding and dead-branch pruning; context-sensitive (k=2) points-to analysis; context-specific sanitizers (html.escape protects HTML only, not SQL or a shell); second-order (stored) injection through database tables.
  • Rules and models — 153 pattern rules, 48 dataflow and APEX rules and 19 built-in VQL queries (VQL is Kashif's declarative query language over the program database), over 6,447 modelled library APIs (1,047 sources, 4,618 sinks, 782 sanitizers).
  • Fewer false positives on real code — test, documentation and example code is recognised by its path: fixture noise there is dropped and the rest is lowered to info; vendored bundles are skipped. On the 35 open-source projects (of 38) that 0.9 could finish, findings went from 17,228 to 2,607 (critical and high: 4,345 to 783); half of 0.9's findings were in test, docs and example code.
  • Fast on large code — --jobs N spreads the per-file work over your CPUs and --cache DIR answers an unchanged project from its cache with identical findings. Django (6,973 files) takes 311–411 s cold on 4 vCPUs (0.9: 594 s) and 3.5 s warm.
  • Autofix — --fix / --fix-dry-run apply verified, deterministic fixes for 39 rules (38 automatically), shown as diffs in the UI, the reports, SARIF and the editor.
  • Oracle APEX & ORDS — APEX application exports (including their Supporting Objects scripts), plug-ins and PL/SQL packages, with authorization checks followed path by path and mapped to the app's authorization schemes.
  • Secrets — provider-specific patterns plus entropy-based detection, and kashif history for every secret ever committed to git, even if a later commit deleted it.
  • Dependencies (SCA) with reachability — 23 manifest and lockfile types; known vulnerabilities from OSV.dev, each marked by whether your code imports the package and calls the vulnerable function (the OSV lookup is optional and the only part of a code scan that uses the network).
  • Archives & Android — zip, tar.gz, whl, APK, JAR, AAR, DEX; with jadx installed, bytecode is decompiled and analyzed.
  • Passive web scanning — security headers, CSP, TLS, cookies, commonly exposed paths, and a crawl with rate limiting and an honest User-Agent. No payloads, no form submission.
  • Team workflow — triage decisions kept in the repository (kashif triage), policy as code (kashif.yml), compliance mapping to 10 frameworks with an auditor report (kashif compliance), an attack-surface map (kashif surface) and a kit to write and test your own rules (kashif rules).
  • AI coding assistants — kashif mcp is an MCP server, so Claude Code, Cursor, VS Code agents, Windsurf and Zed can check the code they write, locally and offline.
  • Outputs — console, Markdown, JSON, HTML and SARIF 2.1.0 (validated against the OASIS schema; works with GitHub Code Scanning and the VS Code SARIF viewer), with stable fingerprints; plus DefectDojo, SonarQube, GitLab SAST, Code Climate, JUnit XML, CSV, Jira, GitHub Issues, AWS Security Hub (ASFF) and OCSF.

What's new in 1.5

  • JavaScript and TypeScript, measured — on CodeQL's labelled security tests (1,238 vulnerable and 267 safe cases, bench/score_js.py) the pooled true-positive rate rose from 48.6% to 59.1% and the false-positive rate fell from 23.2% to 20.2%. Path traversal went from 59.7% to 85.0% found, command injection from 30.0% to 54.2%, SQL/NoSQL injection from 31.1% to 43.9%. Kashif now follows promisified and fs-compatible modules (fs-extra, fs/promises, util.promisify), spawn with a shell, and objects filled field by field, and understands checks against a constant (ALLOWED === x, hasOwnProperty on a constant table) and res.sendFile confined by root. The per-category table and its limits are under Accuracy.
  • PHP, measured — on the NIST SARD PHP Vulnerability Test Suite (41,712 cases, bench/score_php.py) the OWASP-style score rose from 6.0% to 45.4%. Kashif now judges which escaper is enough where the value lands (quoted or bare in SQL, shell, XPath, LDAP and eval; the HTML context around each <?php block), reads the pattern of preg_match and the filter of filter_var, treats backticks and exec() output as commands and sources, and reports redirects whose host comes from the user.
  • Oracle APEX — APX024 finds the APEX components that call a package routine through synonyms, owner.pkg.routine, constant execute immediate, Invoke API processes and other package routines (up to three hops), and takes the authorization scheme of parent regions and of the dynamic-action event. A button's scheme is not counted as protecting the process it submits (a request can name the button even when it is not shown). Readable YAML exports carry schemes too, and an application scanned in both forms is reported once. Deinstall and upgrade scripts, APEX 4 sources built with s := s || … and the APEX 5.0 and 24.1 script formats are now read.
  • Earlier in 1.x — 1.1 rebuilt the passive web scanner from scratch; 1.2 raised the Python Benchmark from 74.0% to 90.2%; 1.3 added APX024 and a measured comparison with Bandit and Semgrep; 1.4 followed the paths inside APX024 routines, read Supporting Objects packages, cut skipped PL/SQL statements tenfold and raised the Python Benchmark to 93.1%. Every release is described in CHANGELOG.md.

Install

One line (verifies the SHA-256 before installing)

# macOS and Linux: installs kashif (and a vulnscan alias) into ~/.local/bin
curl -fsSL https://abdulrahmanahmedelabed-prog.github.io/vulnscan/install.sh | sh
# Windows: installs into %LOCALAPPDATA%\Programs\Kashif and adds it to your PATH
irm https://abdulrahmanahmedelabed-prog.github.io/vulnscan/install.ps1 | iex
# Homebrew (macOS and Linux)
brew tap kashif/vulnscan https://github.com/abdulrahmanahmedelabed-prog/vulnscan
brew install kashif

All three download the release binary over HTTPS and check it against the release's SHA256SUMS.txt. Because they download with curl, macOS does not quarantine the file, so Gatekeeper does not block the (not yet notarized) binary.

Download a binary (nothing else needed)

Get the file for your platform from the latest release:

Platform File
Windows x64 (portable) kashif-windows-x86_64.exe — double-click to open the web UI
Windows x64 (setup wizard) kashif-setup.exe — installs Kashif, optionally adds it to PATH, adds Start-menu and desktop shortcuts, and uninstalls from Windows Settings
Linux x86-64 (Ubuntu 22.04+, Debian 12, RHEL 9+) kashif-linux-x86_64
macOS Apple Silicon kashif-macos-arm64
macOS Intel kashif-macos-x86_64
# Linux
chmod +x kashif-linux-x86_64
./kashif-linux-x86_64                    # opens the web UI
./kashif-linux-x86_64 ./project --fail-on high

# macOS: the binary is not notarized by Apple. Remove the quarantine flag once
# (or right-click the file > Open on first launch):
chmod +x kashif-macos-arm64
xattr -d com.apple.quarantine kashif-macos-arm64
./kashif-macos-arm64

Verify the download. Every release ships SHA256SUMS.txt, a CycloneDX SBOM (kashif-sbom.cdx.json) and signed SLSA build provenance:

sha256sum -c SHA256SUMS.txt --ignore-missing
gh attestation verify kashif-linux-x86_64 --repo abdulrahmanahmedelabed-prog/vulnscan

Install with pip (Python 3.10+)

pip install git+https://github.com/abdulrahmanahmedelabed-prog/vulnscan

Kashif has zero runtime dependencies. You can also run it from a clone with python -m vulnscan.

Updating

The binaries update themselves. In the web UI open Settings > Updates and select Update now, then Restart now; a small "Update available" badge appears in the sidebar when a newer release is out. From a terminal:

kashif update            # check, confirm, download, verify, install
kashif update --check    # only check: exit code 10 when an update is available, 0 when up to date
kashif update --yes      # no confirmation prompt (scripts)

The update is downloaded only from GitHub over HTTPS, checked against the release's SHA256SUMS.txt, refused if it is not newer, and tested (--version) before it atomically replaces the running binary; the previous binary is kept as <name>.old until the next start, and any failure rolls back. On macOS, an Intel binary running under Rosetta is offered the native Apple Silicon build. If the binary's folder is not writable (for example /usr/local/bin), run sudo kashif update. pip and source installs are never modified: the UI and kashif update show the exact command instead (python -m pip install --upgrade ... or git pull). A pip install made before 1.0.2 is the distribution vulnscan (from 1.0.2 on it is kashif): remove it before installing the new version, or the two would own the same files (vulnscan on PyPI is an unrelated project):

python -m pip uninstall -y vulnscan kashif
pip install git+https://github.com/abdulrahmanahmedelabed-prog/vulnscan

The check asks api.github.com for the latest release at most every 6 hours and sends nothing about your code; turn off Check for updates automatically in Settings to disable it.

Quick start

kashif ./my-project                         # colored console report
kashif ./my-project --all-formats report    # report.md / .json / .html / .sarif
kashif app.apk -f html -o report.html       # archives and APKs
kashif . --fail-on high --exclude "tests/*" # CI gate
kashif . --no-deps --no-external            # fully offline
kashif https://my-site.example --authorized # passive web scan of a site you own
kashif ui                                   # web UI on http://127.0.0.1:8765
kashif . --lang en                          # English-only output (ar, en, both; or set VULNSCAN_LANG)

Every finding, remediation, data-flow step and scan note is available in English and Arabic: the web UI switches language in one click, --lang controls the console and the Markdown/HTML reports, and SARIF is English-first for GitHub Code Scanning (Arabic kept in the result properties).

The web UI (dashboard, scan, findings, reports, rules, settings) listens on 127.0.0.1 only; data is stored in ~/.vulnscan (or VULNSCAN_HOME).

Command reference

kashif --help lists every option and sub-command; kashif <sub-command> --help shows the options of one. python3 -m vulnscan ... works the same way, and vulnscan is kept as an alias of kashif.

kashif . -f gitlab-sast -o gl-sast-report.json      # GitLab Security tab and merge-request widget
kashif . -f codeclimate -o gl-code-quality.json     # GitLab Code Quality
kashif . --export defectdojo=dd.json --export junit=kashif.xml   # extra formats from the same scan
kashif . --triage --fail-on high                    # honour the decisions in .kashif/triage.json
kashif . --policy strict                            # a builtin gate; a kashif.yml in the project applies by itself
kashif . --compliance owasp,pci --audit-report audit.html
kashif ui                                           # local web UI
kashif lsp                                          # language server for editors
kashif mcp                                          # MCP server for AI coding assistants
kashif export report.json -f sonarqube -o sonar.json
kashif compliance report.json -f html -o audit.html
kashif history . --max-commits 500                  # secrets in git history (alias: secrets-history)
kashif triage set <fingerprint> false_positive -j "the value is a constant"
kashif triage list
kashif policy init --preset startup                 # writes kashif.yml
kashif policy check report.json
kashif surface . -f openapi -o surface.json         # attack-surface map
kashif rules new my-pack && kashif rules test my-pack
kashif update --check
Sub-command What it does
ui Local web UI on 127.0.0.1 (dashboard, scans, findings, reports, settings).
lsp Language server: findings underlined as you type, quick fixes (setup: editors/README.md).
mcp Model Context Protocol server, so Claude Code, Cursor, VS Code agents, Windsurf and Zed can check the code they write, locally and offline: claude mcp add kashif -- kashif mcp. kashif mcp --print-config all prints the configuration of each client. Tools: scan_path, scan_snippet, get_finding, explain_rule, list_rules, suggest_fix. It reads only inside the project roots and never runs your code.
export Converts a JSON report (-f json) to DefectDojo, SonarQube, JUnit XML, CSV, Jira CSV, GitHub Issues, AWS Security Hub (ASFF), OCSF, GitLab SAST, Code Climate or the Kashif risk score (kashif export --list-formats). The scan's own -f accepts the same formats. The risk score (0-10) is a triage aid, not a CVSS score.
compliance Maps findings (a JSON report, a SARIF file of any tool, or a path to scan) to OWASP Top 10, OWASP API Top 10, ASVS, CWE Top 25, PCI DSS, NIST SSDF, NIST SP 800-53, ISO/IEC 27001, HIPAA and GDPR, and writes a printable auditor report. Evidence for an assessment, not a certification.
history Every secret ever committed, even if a later commit deleted it, with the commit that introduced it and whether it is still at HEAD. Secrets are always redacted. Needs only the git executable.
triage Decisions about findings (false positive, accepted risk with an expiry date, won't fix, fixed) in .kashif/triage.json, with author, justification and an audit log, reviewed in pull requests like code. kashif triage stats reports MTTR, ages and SLA breaches.
policy Policy as code: a kashif.yml gate (severity thresholds, counts, new findings only, forbidden CWEs/rules/OWASP categories, per-path scopes, exceptions with an approver and an expiry). kashif policy check report.json explains each decision.
surface Attack-surface map: HTTP routes, CLI commands, queue consumers and jobs with their untrusted inputs, the visible authentication and the sinks they reach; Markdown, CSV, JSON, Mermaid, Graphviz or an OpenAPI 3.1 skeleton. Static analysis only.
rules Write and test your own rules: new scaffolds a rule pack, test checks fixtures annotated with # kashif: expect RULE, lint, pack (one .kashifpack file with a SHA-256), verify, install, list, docs. Scan with installed packs: --pack NAME or --packs.
update Installs the latest official release after verifying it (--check only checks).
update-data kashif update-data --web installs the web scanner's data snapshot of the latest release after verifying its SHA-256 (--check only checks). Nothing about the sites you scan is sent; without it the bundled snapshot is used.

Scan options added in 1.0: --export FORMAT=FILE (repeatable), --risk-score, --compliance FRAMEWORKS, --audit-report FILE, --triage[=FILE], --triage-update (CI on the main branch only), --triage-show STATUSES, --sla critical=7,high=30, --fail-on-sla, --policy[=FILE|PRESET], --no-policy, --policy-reports-dir DIR, --pack NAME, --packs. A kashif.yml found in the scanned folder is applied automatically and decides the exit code together with --fail-on; a policy or triage file in a pull request can relax the gate for that pull request, so review changes to them like code (kashif triage diff).

CI and GitHub Code Scanning (SARIF)

permissions:
  contents: read
  security-events: write   # required to upload SARIF
steps:
  - uses: actions/checkout@v4
  - uses: actions/setup-python@v5
    with: { python-version: "3.12" }
  - run: pip install git+https://github.com/abdulrahmanahmedelabed-prog/vulnscan
  - run: kashif . --no-deps -f sarif -o vulnscan.sarif
  - uses: github/codeql-action/upload-sarif@v3
    if: always()
    with:
      sarif_file: vulnscan.sarif

Findings appear in the Security tab and inline on pull requests, with a numeric severity, CWE and the dataflow path. Fingerprints are stable across line shifts and reformatting, so alerts are not duplicated.

Pull-request review comments, GitLab, pre-commit

  • GitHub Action (uses: abdulrahmanahmedelabed-prog/vulnscan@v1.5.0): scans the pull request, uploads SARIF and posts one review with inline comments on the changed lines only (rule, severity, remediation, data-flow path), plus a summary comment that is updated, not duplicated, on every push.
  • Diff-aware scanning anywhere: kashif . --diff-base origin/main reports only what the branch introduces (the whole project is still analysed, so cross-file flows stay correct); --fail-on then gates on new findings only.
  • GitLab: -f gitlab-sast (Security tab and merge-request widget; GitLab SAST report schema 15.0) and -f codeclimate (Code Quality); a ready GitLab CI job is in docs/production.md. Scan the repository root so that paths are relative to it.
  • pre-commit: a kashif hook that checks only staged changes.

Full guide: docs/integrations.md.

IDE integration (VS Code, JetBrains, Neovim, Helix, Zed, Sublime, Emacs)

kashif lsp is a Language Server: vulnerabilities are underlined while you work, with the data-flow path as related locations, remediation on hover, and quick fixes to suppress a reviewed finding or add it to the baseline. The VS Code extension (kashif-vscode.vsix, attached to every release) runs it for you; other editors connect to the same server. Setup for each editor: editors/README.md.

Baseline: report only what's new

kashif . --write-baseline .vulnscan-baseline.json          # once; commit the file (fingerprints only)
kashif . --baseline .vulnscan-baseline.json --fail-on high # later: new findings only

Audit profile

--audit additionally lists every dangerous call (eval, shell, SQL, pickle, …) that dataflow analysis could not prove is reached by untrusted input — useful for manual security reviews where you want the whole attack surface, not just proven flows.

Accuracy: OWASP Benchmark

Measured on the OWASP Benchmark for Python v0.1 (1,230 test cases) and the OWASP Benchmark for Java v1.2 (2,740 test cases). Score = mean over categories of TPR − FPR (Youden's J), the scoring method OWASP uses, computed by this project's own scorer (bench/score_owasp.py), not by OWASP's scorecard tool. Python: 93.1% · Java: 98.3%. (Python was 74.0% in 1.1.1 and 90.2% in 1.2.0; see CHANGELOG v1.2.0 and v1.4.0.) On the same Python suite, with the same scorer, Bandit 1.9.4 scores 16.5% and Semgrep 1.186.0 (community rules) 15.7%: see docs/comparison.md for the per-category table and its limits.

Category Py TPR % Py FPR % Py score Java TPR % Java FPR % Java score
cmdi (command injection) 100.0 14.3 85.7 100.0 0.0 100.0
codeinj (code injection) 100.0 0.0 100.0 — — —
crypto (weak cipher) — — — 100.0 0.0 100.0
deserialization (deserialization) 100.0 2.8 97.2 — — —
hash (weak hashing) 100.0 0.0 100.0 100.0 0.0 100.0
ldapi (LDAP injection) 100.0 0.0 100.0 100.0 0.0 100.0
pathtraver (path traversal) 100.0 35.9 64.1 100.0 0.0 100.0
redirect (open redirect) 100.0 0.0 100.0 — — —
securecookie (insecure cookie) 100.0 0.0 100.0 100.0 0.0 100.0
sqli (SQL injection) 100.0 0.0 100.0 100.0 0.0 100.0
trustbound (trust boundary) 100.0 15.8 84.2 100.0 0.0 100.0
weakrand (weak randomness) 100.0 0.0 100.0 100.0 0.0 100.0
xpathi (XPath injection) 100.0 4.4 95.6 100.0 0.0 100.0
xss (cross-site scripting) 100.0 19.0 81.0 100.0 18.2 81.8
xxe (XML external entities) 100.0 5.0 95.0 — — —
Overall 93.1 98.3

Each suite is scanned whole, as one application (the Python repository, the Java src/main tree), with the default profile. Reproduce either with one command:

git clone --depth 1 https://github.com/OWASP-Benchmark/BenchmarkPython && python bench/score_owasp.py BenchmarkPython
git clone --depth 1 https://github.com/OWASP-Benchmark/BenchmarkJava && python bench/score_owasp.py BenchmarkJava

The engine is never tuned to benchmark files: no test-case names, paths or expected results are encoded in it. The weakest categories (Python path traversal, XSS and redirects) are where values need deeper tracking; that gap is reported as measured.

About the Java score (76.3% in 0.9 → 98.3% in 1.0). Two general Java call-resolution fixes explain the whole change. A bare call such as helper(x) now resolves to the enclosing class's own method, so the helper's body is analysed instead of passing taint straight through (258 false positives became true negatives); and a common library method such as toString or getValue is no longer bound to an unrelated project method of the same name (41 missed vulnerabilities are now found). No test case moved in the wrong direction. An independent audit found no Benchmark-specific names, paths or patterns in the engine; a fully renamed copy of the suite scores the same 98.3%, and 516 of 516 mutation tests behaved correctly (renamed safe cases stay quiet; each one made really vulnerable is reported). Caveats: the Benchmark is a synthetic suite, so the score is not a measure of accuracy on real code (the same audit found engine limitations that show on real code and do not affect this score), and 38 Java XSS false positives remain (FPR 18.2%) because HTML escaping is not credited when the escaped value is the format string of format/printf.

JavaScript and TypeScript: CodeQL's labelled security tests

There is no OWASP Benchmark for JavaScript, so JavaScript/TypeScript is measured on the security query tests of GitHub CodeQL (javascript/ql/test/query-tests/Security, commit 12a0e51, MIT licence): small Express, Koa, Next.js, Node and browser programs that the CodeQL team labels line by line as vulnerable (// $ Alert, including MISSING: Alert, which CodeQL itself misses) or safe (// OK … comments and SPURIOUS: Alert, which CodeQL wrongly reports). Kashif's own scorer bench/score_js.py scans the whole directory as one project with the default profile and counts a case as found when a finding of the category's CWE is on the labelled line. It covers the 21 CodeQL queries whose CWE Kashif reports for JavaScript: 1,238 vulnerable and 267 safe cases. All cases pooled: TPR 48.6% → 59.1%, FPR 23.2% → 20.2% from 1.4 to 1.5. The OWASP-style mean of TPR − FPR over the 21 categories is 23.2%, as in 1.4 (see the limits below).

Category Vulnerable / safe cases TPR % (1.4 → 1.5) FPR % (1.4 → 1.5) Score (1.4 → 1.5)
cmdi (command injection) 120 / 1 30.0 → 54.2 0.0 → 100.0 30.0 → -45.8
codeinj (code and template injection) 94 / 5 59.6 → 60.6 20.0 → 20.0 39.6 → 40.6
crypto (weak cipher) 3 / 18 0.0 → 0.0 0.0 → 0.0 0.0 → 0.0
deserialization 8 / 0 75.0 → 75.0 — 75.0 → 75.0
hash (password hashing) 3 / 0 0.0 → 0.0 — 0.0 → 0.0
httponlycookie (cookie without HttpOnly) 20 / 20 20.0 → 20.0 0.0 → 0.0 20.0 → 20.0
loginj (log injection) 23 / 1 60.9 → 60.9 0.0 → 0.0 60.9 → 60.9
pathtraver (path traversal) 253 / 38 59.7 → 85.0 55.3 → 50.0 4.4 → 35.0
redirect-client (open redirect, browser) 70 / 9 48.6 → 48.6 55.6 → 44.4 -7.0 → 4.1
redirect-server (open redirect, server) 30 / 57 76.7 → 76.7 22.8 → 10.5 53.9 → 66.1
securecookie (cookie without Secure) 16 / 5 18.8 → 18.8 0.0 → 0.0 18.8 → 18.8
sqli-nosqli (SQL, NoSQL and LDAP injection) 164 / 36 31.1 → 43.9 8.3 → 8.3 22.8 → 35.6
ssrf (server-side request forgery) 43 / 4 32.6 → 34.9 25.0 → 25.0 7.6 → 9.9
weakrand (weak randomness) 24 / 3 54.2 → 54.2 33.3 → 33.3 20.8 → 20.8
xpathi (XPath injection) 7 / 6 71.4 → 71.4 0.0 → 0.0 71.4 → 71.4
xss-dom (DOM XSS) 243 / 15 61.3 → 64.2 73.3 → 80.0 -12.0 → -15.8
xss-exception (XSS through exception messages) 19 / 4 0.0 → 0.0 0.0 → 0.0 0.0 → 0.0
xss-reflected (reflected XSS) 75 / 28 52.0 → 61.3 21.4 → 21.4 30.6 → 39.9
xss-stored (stored XSS) 5 / 0 0.0 → 0.0 — 0.0 → 0.0
xxe (XML external entities) 8 / 17 50.0 → 50.0 0.0 → 0.0 50.0 → 50.0
zipslip (archive path traversal) 10 / 0 0.0 → 0.0 — 0.0 → 0.0
All cases pooled 1,238 / 267 48.6 → 59.1 23.2 → 20.2
Mean over categories 23.2 → 23.2
git clone --filter=blob:none --sparse https://github.com/github/codeql
git -C codeql sparse-checkout set javascript/ql/test/query-tests/Security
python bench/score_js.py codeql

What it measures and its limits: these are CodeQL's unit tests, written to exercise CodeQL's own models, so they favour what CodeQL models (many npm packages, framework conventions, CodeQL's location rules) and the labels are CodeQL's opinion, not ground truth (one SPURIOUS: Alert line in cmdi says it "should be fine to flag it"; it is the category's only safe case, so that one finding is an FPR of 100% for the category). Safe cases are few (267) and unevenly spread: cmdi has 1, xss-dom 15, ssrf 4, so the per-category mean moves a lot with single findings; the pooled rates are the steadier number. Some categories test things Kashif does not model: exception messages that carry their argument (xss-exception), sensitive-data flows into weak ciphers and hashes (crypto, hash; Kashif reports the weak algorithm where the cipher is created, CodeQL where data is written into it), cookies whose secure or HttpOnly flag is missing rather than set to false, archive entry names as sources (zipslip), and data read from files (xss-stored). Lines with no label are not counted (CodeQL asserts no alert there, but most are not sinks); the scorer prints how many findings land on them (159). The suite is not real code: read the numbers as how the engine reasons about common JavaScript constructs, not as its accuracy on your project.

PHP: NIST SARD PHP Vulnerability Test Suite

Measured on the PHP Vulnerability Test Suite (Stivalet & Delaitre, NIST SARD test suite 103; commit 6ebd7e0), with labels taken from the suite's own manifests. Every test case of the eight data-flow categories is scored, 41,712 of the suite's 42,212 (left out: 480 missing-authorization cases, CWE-862, and 20 crypto / error-message cases). Same scoring as above, by bench/score_php.py. PHP: 45.4% (6.0% before 1.5.0).

Category TPR % FPR % score (1.4) score (1.5)
cmdi (CWE-78) 48.1 16.0 0.0 32.1
codeinj (CWE-95, eval) 53.6 3.6 9.6 49.9
fileinc (CWE-98, include) 62.5 19.7 9.6 42.8
ldapi (CWE-90) 76.7 41.7 1.3 35.0
redirect (CWE-601) 68.6 0.0 9.9 68.6
sqli (CWE-89) 64.1 1.0 16.6 63.1
xpathi (CWE-91 in the suite: XPath) 51.0 16.0 5.9 35.0
xss (CWE-79) 44.4 8.1 -5.3 36.3
Overall 6.0 45.4
git clone --depth 1 https://github.com/stivalet/PHP-Vulnerability-test-suite && python bench/score_php.py PHP-Vulnerability-test-suite

What it measures: one source, one sanitizer and one sink per generated script, over 16 kinds of input and 21 HTML output contexts, so it tests the per-function and per-context rules (which escaper is enough where), not whole-application reasoning. Read it with its limits: the code is synthetic, and many of its labels disagree with how PHP behaves, where Kashif follows PHP (for example addslashes or escapeshellarg inside a single-quoted shell argument are labelled safe and are injectable; htmlspecialchars inside a quoted onclick handler is labelled safe and is not, because the browser decodes &#039; before running it; an XPath literal has no backslash escape; a few cases do not parse or read an undefined variable). $_SESSION is not treated as user input (one input kind of 16), and the output of shell commands is a local source, not reported for XSS or redirects. No file names, paths or generator-specific helper names are encoded in the engine.

Languages and targets

Target Coverage
Dataflow (taint) Python, JavaScript/TypeScript, Java, Kotlin, C#, Go, PHP, C/C++, Rust, Swift, Ruby, PL/SQL
Oracle APEX application exports, plug-ins, PL/SQL packages, ORDS
Android / JVM APK, JAR, AAR, DEX (decompiled with jadx when installed)
Config & CI Dockerfile, docker-compose, GitHub Actions, AndroidManifest, iOS plist, config files
Web (passive) headers, CSP, TLS, cookies, exposed paths, rate-limited crawl (--authorized required)

Passive web scanning

kashif https://my-site.example --authorized reads what a site already serves, the way a browser would, and judges it against 184 rules (34 kept from 1.0 with the same ids, 150 new): transport and HSTS, Content-Security-Policy, framing and the other response headers, CORS, cookies, page content and the page's own JavaScript, information disclosure, TLS and certificates, components (retire.js data), exposed files and security.txt. It never sends a payload, never submits a form, never fuzzes or guesses, never spoofs headers, sends an honest User-Agent (Kashif/<version>) and keeps at least --delay seconds (floor 0.2) between two requests to one host.

kashif https://my-site.example --authorized                        # standard profile (at most 45 requests)
kashif https://my-site.example --authorized --web-profile minimal  # the page and its redirects only (at most 10)
kashif https://my-site.example --authorized --deep                 # + commonly exposed files (at most 150)
kashif https://my-site.example --authorized --crawl --max-pages 50 # + same-origin pages (same scheme, host and port)
kashif https://my-site.example --authorized --web-sensitivity strict -f sarif -o web.sarif
kashif https://my-site.example --authorized --compare-previous     # diff against the last saved scan of the site
kashif https://my-site.example --authorized --compare old-report.json   # or a scan id from the local history
kashif update-data --web                                           # newer web data from the latest release
Option Meaning
--web-profile minimal|standard|deep minimal is the 1.0 single fetch (the entry chain, at most 10 requests); standard (default) adds the http/https counterpart, one cookieless CORS GET with Origin: https://kashif-cors-check.invalid, robots.txt, security.txt, the favicon, /sitemap.xml (with --crawl) and up to 15 of the page's own scripts and styles (at most 45); deep (--deep) adds a fixed list of commonly exposed files, the login and administration pages of a detected platform (fetched once, nothing submitted), soft-404 baselines, third-party scripts, source maps and images (at most 150). Crawled pages come on top.
--web-sensitivity strict|default|paranoid strict reports certain findings only, default certain and firm, paranoid everything, including the paranoid-only checks. Every finding carries its confidence (certain, firm or tentative).
--crawl, --max-pages N, --max-depth N, --ignore-robots Breadth-first crawl of same-origin links (same scheme, host and port), at most 500 pages (default 20, depth 2); robots.txt is honoured unless you own the site and pass --ignore-robots. Needs standard or deep: minimal cannot crawl. A scan stops sending after 600 s or 50 MB received.
--compare-previous, --compare ID|FILE New, resolved and unchanged findings, grade changes and posture changes ("CSP changed", "new third-party script host", "certificate renewed"). --compare-previous keeps the scan in the local history (~/.vulnscan, or $VULNSCAN_HOME) and prints its id on stderr; --compare takes such an id (also on the UI's Reports page and in $VULNSCAN_HOME/index.json) or a JSON report (-f json). In CI, use --compare previous.json. kashif history is unrelated (it searches git history for secrets).
--fail-on-inconclusive Exit code 1 when a WAF, challenge or rate limit answered instead of the site (Kashif grade ? or WEB990), which --fail-on alone lets pass.
--ignore-rule ID Leave a web rule out of the report and of --fail-on (the grades still count it).
--web-cookie-ignore NAME Leave a cookie out of the cookie checks (repeatable).
--third-party-lookups Allow lookups that reveal the site's name to a third party. Off by default; in 1.1 no check makes such a lookup (the HSTS preload list and certificate transparency come from bundled data and the certificate itself).
--no-proxy Do not use HTTP(S)_PROXY. Only http:// proxies are supported; any other proxy setting stops the scan with a proxy error (exit code 2; in the JSON report web.error.code starts with proxy), never a silent direct connection. Through a proxy, DNS-based checks are not tested and TLS findings are tentative, so they appear only with --web-sensitivity paranoid; use --no-proxy or NO_PROXY to assess TLS directly.

Every report shows three grades (the Kashif Web Grade A+ to F, an MDN HTTP Observatory-compatible score, and an SSL Labs-compatible TLS grade that excludes the attack-only tests Kashif does not perform), an honest coverage table (passed, failed, not applicable, not tested, inconclusive: a check that did not run is never shown as passed), the site inventory (security headers, CSP, cookies, TLS, technologies, third parties), copy-paste fixes for 18 platforms (nginx, Apache httpd, IIS, Caddy, Express, Node.js, Django, Flask, Spring, Tomcat, ASP.NET Core, ASP.NET, PHP, Laravel, Symfony, Rails, Cloudflare, F5 BIG-IP; the detected platforms first) and, with a previous scan, the diff. SARIF results carry properties.precision and the tags external/cwe/cwe-N, wstg:…, asvs4:… and asvs5:…; the JSON report has the same data under the web key. All rules, their mappings and default severities are listed in docs/web-checks.md; docs/web-scanning.md describes the traffic, the profiles, the reports and the upgrade from 1.0.

In CI (full example in docs/web-scanning.md): kashif https://staging.example.com --authorized --fail-on high --fail-on-inconclusive -f sarif -o kashif-web.sarif. Exit code 0 means the gate passed, 1 that it failed (a finding at or above --fail-on, the policy gate, or an inconclusive scan with --fail-on-inconclusive), 2 that nothing was judged (--authorized missing, a rejected option combination, or a site that could not be reached; -o then still writes a report whose web.status is "unreachable"). Upload the SARIF with github/codeql-action/upload-sarif and category: kashif-web, so it does not replace the code scan's results; web alerts carry a URL, not a file location, so they never annotate pull-request lines. Keep the JSON report of each run and pass --compare previous.json to the next one to see regressions.

Policy files: for a URL, pass the file explicitly (--policy kashif.yml); none is picked up automatically. rules.disable and rules.severity change what the gate counts, not the report (use --ignore-rule to hide a rule), and the default gate fails on high, so set gate.fail_on:

version: 1
gate:
  fail_on: medium             # the default gate fails on high
rules:
  disable:
    - id: WEB071
      reason: "certificates are renewed automatically 30 days before expiry"

What a passive scan cannot find: it reads anonymous pages only, and it does not test injection, XSS, authentication, access control or business logic; certificate revocation (CRL/OCSP) is not checked either. A grade measures configuration hygiene, not the absence of vulnerabilities: pair the web scan with a code scan (SAST) and an authorised active test.

Limitations

  • Static analysis finds common patterns and flows; it does not replace human review or penetration testing.
  • False positives and misses happen. Suppress a reviewed line with # nosec or // vulnscan: ignore, or a rule with --ignore-rule.
  • Compared with CodeQL, Semgrep, SonarQube or Snyk Code, Kashif has fewer library models (about 6,350 modelled APIs and 153 pattern rules) and less real-world tuning on large codebases (1.0 was tuned on 38 open-source projects). Its strengths are running fully locally with zero dependencies, English and Arabic output, Oracle APEX, archives/APKs and passive web checks in one tool.
  • Not modelled yet: templates other than Jinja (EJS, ERB and similar), values that reach a PHP file through include, and values that flow through files or databases outside the scanned code. Large projects need memory: Django (about 7,000 files) peaks at about 3.5 GB.
  • Without jadx, APK/JAR contents are scanned as text only; decompiled code may differ from the original source.
  • The web scan is passive only: no active testing of any kind. It sees anonymous pages only, does not test injection, XSS, authentication, access control or business logic, and does not check certificate revocation; its grade measures configuration hygiene, not the absence of vulnerabilities.

Production use

From 1.0 Kashif follows semantic versioning with a written stability contract: command-line flags and exit codes, the JSON/SARIF/GitLab/Code Climate report schemas, finding fingerprints and baseline files, rule IDs, suppression comments, LSP settings and the action's inputs do not break within 1.x. A container image is published for linux/amd64 and linux/arm64 (non-root, works with a read-only root filesystem):

docker run --rm -v "$PWD:/src" ghcr.io/abdulrahmanahmedelabed-prog/kashif:1 .

The contract, the support policy and the deployment recipes (CI, air-gapped networks, a team dashboard behind an authenticating reverse proxy, scaling) are in docs/production.md.

Security policy

Please report vulnerabilities in Kashif privately via GitHub's private vulnerability reporting; see SECURITY.md. All GitHub Actions in this repository are pinned by commit SHA, an OpenSSF Scorecard workflow runs on the repository, and every release ships checksums, an SBOM and signed SLSA provenance.

About

Kashif is developed by the Programming Department at the Islamic University of Gaza. Contact: its@iugaza.edu.ps and aelabed@iugaza.edu.ps

License

MIT.


English | العربية

كاشِف (vulnscan) — فاحص ثغرات مستقل لأي برنامج

كاشِف هو الاسم العربي للأداة؛ وkashif هو اسم الأمر (ويبقى vulnscan، اسمه السابق واسم حزمة Python، اسمًا بديلًا يعمل كما هو).

أداة بلغة Python (بدون أي اعتماديات خارجية) تفحص أي برنامج وتُخرج تقريرًا مرتبًا من الأعلى خطورة إلى الأقل: حرج ← عالٍ ← متوسط ← منخفض ← معلوماتي. تعمل من سطر الأوامر، أو من واجهة رسومية محلية بلوحة تحكم وتقارير وإعدادات.

لوحة التحكم نتيجة مع مسار تدفق البيانات وطريقة الإصلاح
لوحة تحكم كاشِف نتيجة حقن SQL مع مسارها من المصدر إلى نقطة الخطر
فحص جديد: مجلد أو ملف مضغوط أو موقع التقارير والمقارنة (الوضع الداكن)
شاشة الفحص الجديد التقارير في الوضع الداكن

⚠️ الصلاحية أولًا: افحص فقط ما تملكه أو ما لديك تصريح كتابي بفحصه. فحص أنظمة الآخرين دون إذن قد يكون مخالفًا للقانون. فحص عناوين الويب لا يعمل إلا مع العلامة --authorized.

ماذا يفحص؟

الهدف مثال ما يحدث
مجلد مصدر بأي لغة kashif ./my-app يمر على كل الملفات النصية ويطبّق 153 قاعدة نمطية و48 قاعدة تدفق بيانات وAPEX و19 استعلام VQL
ملف واحد kashif server.py يفحص الملف وحده
أرشيف / حزمة kashif app.apk أو .jar .zip .whl .tar.gz يفكّه في مجلد مؤقت ويفحص محتواه
عنوان ويب (سلبي) kashif https://my-site.example --authorized [--deep] [--crawl] ترويسات الأمان، الكوكيز، CSP، TLS، تحليل الصفحة وبصمة المنصّة؛ --deep للمسارات المكشوفة و--crawl لزحف الصفحات

القواعد المدمجة تغطي: Python، JavaScript/TypeScript، Dart/Flutter، Java/Kotlin، Go، PHP، Ruby، C#، C/C++، Shell، Dockerfile، docker-compose، GitHub Actions، AndroidManifest، iOS plist، وملفات الإعدادات.

فئات الثغرات: أسرار ومفاتيح مضمّنة، تنفيذ أوامر/كود (RCE)، حقن SQL/XSS/قوالب/مسارات، فك تسلسل غير آمن، تشفير ضعيف وتعطيل TLS، إعدادات خطرة (debug، CORS، 0.0.0.0)، أمان الموبايل، أمان الحاويات و CI، سلامة الذاكرة في C، تسجيل بيانات حساسة، وملفات لا يجوز شحنها (.env، مفاتيح SSH، قواعد بيانات).

الجديد في 1.5

  • JavaScript وTypeScript بأرقام مقيسة: على اختبارات CodeQL المُعلَّمة (1,238 حالة ثغرة و267 حالة آمنة، bench/score_js.py) ارتفعت نسبة الثغرات المكتشفة في المجموع من 48.6% إلى 59.1%، وانخفضت نسبة الإنذارات الخاطئة من 23.2% إلى 20.2%. ارتفع اكتشاف اجتياز المسار من 59.7% إلى 85.0%، وحقن الأوامر من 30.0% إلى 54.2%، وحقن SQL/NoSQL من 31.1% إلى 43.9%. صار Kashif يتتبّع الوحدات المحوّلة إلى وعود والمتوافقة مع fs (fs-extra وfs/promises وutil.promisify)، وspawn مع الصدفة، والكائنات التي تُملأ حقلًا حقلًا، ويفهم المقارنة بقيمة ثابتة (ALLOWED === x وhasOwnProperty على جدول ثابت) وres.sendFile المقيّدة بـ root. والجدول لكل فئة مع حدوده في قسم الدقة.
  • PHP بأرقام مقيسة: على مجموعة NIST SARD لثغرات PHP (41,712 حالة، bench/score_php.py) ارتفعت النتيجة بطريقة OWASP من 6.0% إلى 45.4%. صار Kashif يحكم أي دالة هروب تكفي حيث تقع القيمة (بين علامتي اقتباس أو دونهما في SQL والصدفة وXPath وLDAP وeval، وسياق HTML حول كل كتلة <?php)، ويقرأ نمط preg_match ومرشّح filter_var، ويعامل علامات ` ومخرجات exec() أوامرَ ومصادرَ للبيانات، ويُبلغ عن إعادة التوجيه إلى مضيف يحدده المستخدم.
  • Oracle APEX: تجد APX024 مكوّنات APEX التي تستدعي روتين الحزمة عبر المرادفات وowner.pkg.routine وexecute immediate بنص ثابت وعمليات Invoke API وروتينات الحزم الأخرى (حتى ثلاث خطوات)، وتأخذ مخطط التفويض من المناطق الأم ومن حدث الإجراء الديناميكي. ولا يُعدّ مخطط الزر حمايةً للعملية التي يرسلها (يمكن إرسال طلب يحمل اسم الزر ولو لم يُعرض). وتُقرأ المخططات من التصدير المقروء (YAML) أيضًا، والتطبيق المفحوص بصيغتيه يُبلَّغ عنه مرة واحدة. وصارت تُقرأ سكربتات إزالة التثبيت والترقية، ومصادر APEX 4 المبنية بـ s := s || …، وصيغ السكربتات في APEX 5.0 و24.1.
  • قبل ذلك في 1.x: أعاد 1.1 بناء فاحص المواقع السلبي من جديد، ورفع 1.2 نتيجة Python في Benchmark من 74.0% إلى 90.2%، وأضاف 1.3 القاعدة APX024 ومقارنة مقيسة مع Bandit وSemgrep، وتتبّع 1.4 المسارات داخل روتينات APX024 وقرأ حزم كائنات الدعم وقلّل عبارات PL/SQL المتخطّاة عشر مرات ورفع نتيجة Python إلى 93.1%. تفاصيل كل إصدار في CHANGELOG.md.

ما أضافه 1.0

  • إصلاح تلقائي (--fix و--fix-dry-run) لـ 39 قاعدة (38 تلقائيًا)، لا يُعرض إلا بعد التأكد أن الملف المعدَّل سليم وأن القاعدة لم تعد تنطبق؛ ويظهر الفرق في الواجهة والتقارير وSARIF والمحرر.
  • تحليل التبعيات مع قابلية الوصول: 23 نوعًا من ملفات التبعيات والقفل، ولكل ثغرة معروفة (OSV.dev) هل يستورد الكود الحزمة وهل يستدعي الدالة المصابة.
  • الأسرار في تاريخ git (kashif history)، والفرز داخل المستودع (kashif triage)، والسياسة ككود (kashif.yml)، والامتثال لعشرة أطر مع تقرير للمدقق (kashif compliance)، وخريطة سطح الهجوم (kashif surface)، وعُدّة كتابة القواعد (kashif rules).
  • خادم MCP (kashif mcp) يتيح لـ Claude Code وCursor ووكلاء VS Code وWindsurf وZed فحص الكود الذي يكتبونه محليًا.
  • التصدير: DefectDojo وSonarQube وGitLab SAST وCode Climate وJUnit وCSV وJira وGitHub Issues وAWS Security Hub (ASFF) وOCSF.
  • إنذارات كاذبة أقل: كود الاختبارات والتوثيق والأمثلة يُعرف من مساره فتُحذف منه نتائج بيانات الاختبار وتُخفَّض البقية إلى info، ويُتخطّى الكود المضمَّن من مكتبات خارجية. في 35 مشروعًا مفتوح المصدر (من 38) كان 0.9 يُنهي فحصها، نزلت النتائج من 17,228 إلى 2,607 (الحرجة والعالية من 4,345 إلى 783)، وكان نصف نتائج 0.9 في كود الاختبارات والتوثيق والأمثلة.
  • أسرع: --jobs N لتوزيع الفحص على المعالجات، و--cache DIR لإعادة فحص مشروع لم يتغير بالنتائج نفسها: Django كاملًا (6,973 ملفًا) في 311–411 ثانية أول مرة على 4 معالجات افتراضية (كان 594 ثانية في 0.9)، و3.5 ثوانٍ عند الإعادة.
  • النماذج 6,447 واجهة مكتبة (مصادر 1,047، ونقاط خطر 4,618، ومعقّمات 782). التفاصيل في CHANGELOG.md.

فحص المواقع السلبي

يقرأ kashif https://my-site.example --authorized ما يقدّمه الموقع أصلًا كما يقرؤه المتصفح، ويحكم عليه بـ 184 قاعدة (34 منها من الإصدار 1.0 بالمعرّفات نفسها، و150 جديدة): النقل وHSTS، وسياسة CSP، وحماية الإطارات وبقية ترويسات الاستجابة، وCORS، والكوكيز، ومحتوى الصفحة وسكربتاتها، وتسرّب المعلومات، وTLS والشهادات، والمكوّنات (بيانات retire.js)، والملفات المكشوفة وsecurity.txt. لا يرسل أي حمولة، ولا يملأ نموذجًا، ولا يخمّن أو يجرّب مسارات عشوائية، ولا يزوّر الترويسات، ويعرّف نفسه بصدق (Kashif/<الإصدار>) ويترك --delay ثانية على الأقل (والحد الأدنى 0.2) بين طلبين إلى المضيف نفسه.

kashif https://my-site.example --authorized                        # نمط الفحص standard (45 طلبًا على الأكثر)
kashif https://my-site.example --authorized --web-profile minimal  # الصفحة وتوجيهاتها فقط (10 طلبات على الأكثر)
kashif https://my-site.example --authorized --deep                 # مع الملفات المكشوفة الشائعة (150 طلبًا على الأكثر)
kashif https://my-site.example --authorized --crawl --max-pages 50 # مع صفحات الأصل نفسه (المخطط والمضيف والمنفذ)
kashif https://my-site.example --authorized --web-sensitivity strict -f sarif -o web.sarif
kashif https://my-site.example --authorized --compare-previous     # مقارنة بآخر فحص محفوظ للموقع
kashif https://my-site.example --authorized --compare old-report.json   # أو معرّف فحص من السجل المحلي
kashif update-data --web                                           # بيانات ويب أحدث من آخر إصدار
الخيار معناه
--web-profile minimal|standard|deep minimal هو طلب الإصدار 1.0 الواحد (الصفحة وتوجيهاتها، 10 طلبات على الأكثر)؛ وstandard (الافتراضي) يضيف نسخة http/https وطلب CORS واحدًا بلا كوكيز والملفين robots.txt وsecurity.txt والأيقونة و/sitemap.xml (مع --crawl) وحتى 15 من سكربتات الصفحة وأنماطها (45 طلبًا على الأكثر)؛ وdeep (أو --deep) يضيف قائمة ثابتة من الملفات المكشوفة الشائعة، وصفحات الدخول والإدارة للمنصّة المكتشفة (تُطلب مرة واحدة دون إرسال أي بيانات)، وخطوط أساس لصفحات 404، وسكربتات الأطراف الثالثة وخرائط المصدر والصور (150 طلبًا على الأكثر). وصفحات الزحف إضافة على ذلك.
--web-sensitivity strict|default|paranoid strict النتائج المؤكَّدة فقط، وdefault المؤكَّدة والمرجَّحة، وparanoid كل شيء مع الفحوص الخاصة بهذا المستوى. وكل نتيجة تحمل درجة ثقتها (مؤكَّدة أو مرجَّحة أو محتملة).
--crawl و--max-pages N و--max-depth N و--ignore-robots زحف بالعرض أولًا على روابط الأصل نفسه (المخطط والمضيف والمنفذ أنفسها)، بحدّ أعلى 500 صفحة (الافتراضي 20 صفحةً بعمق 2)؛ ويُحترم robots.txt إلا إن كنت مالك الموقع وأضفت --ignore-robots. ويحتاج إلى standard أو deep، فلا زحف في minimal. ويتوقف الفحص عن الإرسال بعد 600 ثانية أو بعد استقبال 50 ميغابايت.
--compare-previous و--compare ID|FILE النتائج الجديدة والمحلولة والثابتة، وتغيّر الدرجات وتغييرات الوضع الأمني («تغيّرت سياسة CSP»، «مضيف سكربتات جديد»، «جُدّدت الشهادة»). يحفظ --compare-previous الفحص في السجل المحلي (~/.vulnscan أو $VULNSCAN_HOME) ويطبع معرّفه على stderr، ويقبل --compare هذا المعرّف (ويظهر أيضًا في صفحة التقارير في الواجهة وفي $VULNSCAN_HOME/index.json) أو تقرير JSON (-f json). وفي CI استعمل --compare previous.json. ولا علاقة لـ kashif history بذلك (فهو يبحث في سجل git عن الأسرار).
--fail-on-inconclusive رمز الخروج 1 إذا أجاب جدار حماية أو تحدٍّ أو تقييد معدل بدل الموقع (درجة كاشِف ? أو النتيجة WEB990)، وهو ما يمرّره --fail-on وحده.
--ignore-rule ID استبعاد قاعدة ويب من التقرير ومن --fail-on (وتبقى الدرجات تحسبها).
--web-cookie-ignore NAME استبعاد كوكي من فحوص الكوكيز (يمكن تكراره).
--third-party-lookups السماح باستعلامات تكشف اسم الموقع لطرف ثالث؛ معطّلة افتراضيًا، ولا يجري أي فحص في الإصدار 1.1 استعلامًا كهذا (فقائمة HSTS preload وشفافية الشهادات من بيانات مضمّنة ومن الشهادة نفسها).
--no-proxy عدم استخدام HTTP(S)_PROXY. ولا يدعم كاشِف إلا الوكيل من نوع http://، وأي إعداد آخر يوقف الفحص بخطأ في الوكيل (رمز الخروج 2، وقيمة web.error.code في تقرير JSON تبدأ بـ proxy) ولا يتصل مباشرةً خفية. وعبر الوكيل تُعدّ الفحوص المعتمدة على DNS «لم تُجرَ» ونتائج TLS «محتملة»، فلا تظهر إلا مع --web-sensitivity paranoid؛ ولتقييم TLS مباشرةً استعمل --no-proxy أو NO_PROXY.

يعرض كل تقرير ثلاث درجات (درجة كاشِف للويب من A+ إلى F، ودرجة متوافقة مع MDN HTTP Observatory، ودرجة TLS متوافقة مع SSL Labs دون اختبارات الهجوم التي لا يجريها كاشِف)، وجدول تغطية صادقًا (ناجح، فاشل، غير منطبق، لم يُجرَ، غير حاسم: الفحص الذي لم يُجرَ لا يُعرض ناجحًا أبدًا)، وجرد الموقع (ترويسات الأمان وCSP والكوكيز وTLS والتقنيات والأطراف الثالثة)، وإصلاحات جاهزة للنسخ لـ 18 منصةً (nginx وApache httpd وIIS وCaddy وExpress وNode.js وDjango وFlask وSpring وTomcat وASP.NET Core وASP.NET وPHP وLaravel وSymfony وRails وCloudflare وF5 BIG-IP، والمنصّات المكتشفة أولًا)، ومع فحص سابق: المقارنة. وتحمل نتائج SARIF الخاصية properties.precision والوسوم external/cwe/cwe-N وwstg:… وasvs4:… وasvs5:…، ويحمل تقرير JSON البيانات نفسها تحت المفتاح web. القواعد وربطها ودرجات خطورتها في docs/web-checks.md، والطلبات والملفات والتقارير والترقية من 1.0 في docs/web-scanning.md. وفي الواجهة الرسومية الخيارات نفسها في نموذج فحص الويب، وبطاقة الدرجات وجدول التغطية وتبويبات الجرد والإصلاحات والمقارنة.

في CI (المثال الكامل في docs/web-scanning.md): kashif https://staging.example.com --authorized --fail-on high --fail-on-inconclusive -f sarif -o kashif-web.sarif. ورمز الخروج 0 يعني نجاح البوابة، و1 فشلها (نتيجة بخطورة --fail-on أو أعلى، أو بوابة السياسة، أو فحص غير حاسم مع --fail-on-inconclusive)، و2 أنه لم يُحكم على شيء (غياب --authorized، أو توليفة خيارات مرفوضة، أو تعذّر الوصول إلى الموقع؛ ويكتب -o حينها تقريرًا مع ذلك قيمة web.status فيه "unreachable"). ارفع SARIF بالإجراء github/codeql-action/upload-sarif مع category: kashif-web حتى لا يحلّ محل نتائج فحص الكود؛ وموضع إنذارات الويب عنوان URL لا ملف، فلا تظهر تعليقاتٍ على أسطر طلب الدمج. واحتفظ بتقرير JSON من كل تشغيل ومرّره إلى التالي بـ --compare previous.json لرؤية التراجعات.

ملف السياسة: مع عنوان ويب مرّر الملف صراحةً (--policy kashif.yml)، فلا يُلتقط أي ملف تلقائيًا. وrules.disable وrules.severity تغيّران ما تحسبه البوابة لا التقرير (ولإخفاء قاعدة من التقرير استعمل --ignore-rule)، والبوابة الافتراضية تفشل عند high، فاضبط gate.fail_on:

version: 1
gate:
  fail_on: medium             # البوابة الافتراضية تفشل عند high
rules:
  disable:
    - id: WEB071
      reason: "certificates are renewed automatically 30 days before expiry"

ما لا يكشفه الفحص السلبي: يقرأ الصفحات العامة فقط، ولا يختبر الحقن ولا XSS ولا المصادقة ولا التحكم في الوصول ولا منطق العمل، ولا يتحقق من إلغاء الشهادة (CRL/OCSP). والدرجة تقيس سلامة الإعدادات لا خلوّ الموقع من الثغرات: فاجمع فحص الويب مع فحص الكود (SAST) ومع اختبار نشط مصرَّح به.

⚠️ كل فحص ويب يتطلب --authorized (أو تفعيل الإقرار في الواجهة). افحص فقط المواقع التي تملكها أو لديك تصريح كتابي بفحصها.

تحليل تدفق البيانات (Taint) — محرّك مدرك للأنواع على نهج CodeQL

إضافةً إلى قواعد الأنماط، يبني كاشِف نموذجًا واحدًا للمشروع كله ويتتبّع البيانات من المصادر غير الموثوقة إلى نقاط الخطر عبر الدوال والأصناف والملفات. ما يجعله قريبًا من CodeQL:

القدرة كيف تعمل في كاشِف
نماذج كبيانات (Models-as-Data) المصادر ونقاط الخطر والمُعقّمات ونقاط الدخول والمدقّقات مُعرَّفة في JSON (vulnscan/models/python.json). أضف نماذج مكتباتك بـ --models DIR أو من الإعدادات دون تعديل الكود.
نماذج مكتبات مدمجة Flask/Django/FastAPI/Starlette/Tornado/aiohttp كمصادر ونقاط دخول؛ نقاط خطر لـ os/subprocess/SQL (execute، raw، sqlalchemy.text)/الملفات/pickle/yaml/القوالب/redirect/SSRF (requests، urlopen، httpx)/عمليات نظام الملفات/الاستيراد الديناميكي/XSS الانعكاسي/LDAP/XPath/حقن السجلات. 16 قاعدة DF001–DF016.
نقاط دخول أطر العمل معاملات الدوال المُوجَّهة (@app.route، @router.get، views بالأصناف، أوامر CLI) مصادر تلقائيًا، كما في RemoteFlowSource.
حلّ استدعاءات مدرك للأنواع نوع المتغير من المُنشئ والتعليقات وself والحقول وأنواع الإرجاع؛ حلّ الدوال عبر MRO مع التعدد الشكلي؛ تتبّع قيم الدوال (h = helper، functools.partial) و*args/**kwargs؛ والاستيرادات المطلقة والنسبية والمستعارة (import subprocess as sp).
حساسية الحقول والحاويات self.x بين الدوال، وسائط المُنشئ إلى الحقول، append/التخزين بالفهرس/القوائم الحرفية.
points-to حسّاس للسياق (k=2) وحسّاس للتدفق تحليل Andersen بسلسلة استدعاء بعمق اثنين واستنساخ الكائنات، فالمصنع المستدعى من موضعين يعيد كائنين مختلفين حتى عبر غلاف وسيط؛ والمتغيرات المحلية بصيغة SSA (تحديث قوي، ودمج الفروع، وحلقات بنقاط φ) فإعادة الإسناد تلغي التلوّث السابق.
حواجز التحقق (path-sensitivity) if x in ALLOWED:، x.isalnum()، re.fullmatch(..، x)، وif not valid(x): return تمنع الإبلاغ عن النقطة المحروسة، داخل الدالة وعبر الدوال المساعدة.
مسار التدفق الكامل كل نتيجة تحمل خطوات المسار من المصدر إلى نقطة الخطر عبر الإسنادات والاستدعاءات والملفات، وتُعرض في الواجهة والتقارير.
دقة التصنيف عنصر ملوّث داخل قائمة وسائط بعد برنامج ثابت وبلا shell=True = حقن وسائط (DF009، متوسط) لا حقن أوامر (DF003)؛ getoutput/os.system بسلاسل shell = حرج.
كتم مراجَع # nosec على سطر نقطة الخطر يكتم النتيجة وكل ما يُشتق منها في المستدعين.
# io_mod.py
def read_name():  return request.args["name"]   # يعيد بيانات غير موثوقة
# exec_mod.py
def run(cmd):     os.system(cmd)                 # وسيط يصل إلى نقطة خطر
# views.py
@app.route("/x")
def handler():    run(read_name())               # ← يُبلَّغ عنه مع مسار: io_mod.py:2 → views.py:3 → exec_mod.py:2

مثال على نموذج مستخدم (my_models.json):

{"sinks": [{"rule": "DF901", "severity": "high", "cwe": "CWE-999", "label": "mylib.dangerous",
            "names": ["mylib.dangerous"], "title": "custom sink", "title_ar": "نقطة خطر مخصصة",
            "advice": "لا تمرّر مدخلات المستخدم.", "args": [0]}],
 "sanitizers": ["mylib.clean"]}

ما يبقى مختلفًا عن CodeQL بصدق: لا نمذجة كاملة للمكتبة المعيارية لكل لغة (النماذج تغطي الأطر الشائعة لا كل واجهة)، ولا تكامل IDE/مراجعة الطلبات، وواجهات اللغات غير Python تحليلية متسامحة — لكنها الآن تُبلّغ عن كل عبارة تخطّتها (سطرها وسببها في ملاحظات الفحص) فلا يسقط شيء بصمت. القيود الأربع التي كانت قائمة أُغلقت: صار points-to حسّاسًا للسياق بعمق اثنين وحسّاسًا للتدفق، وصارت VQL تدعم الأصناف والمسندات الذاتية والتجميعات، وصار المحرّك يغطّي 12 لغة.

تحليل points-to (تحليل المؤشّرات)

فوق استنتاج الأنواع، يُجري المحرّك تحليل points-to على نهج Andersen، حسّاسًا لموضع الاستدعاء (k = 1) مع استنساخ الكائنات لكل سياق (vulnscan/pointsto.py): كل استدعاء مُنشئ وكل قائمة/قاموس حرفي وكل دالة كقيمة كائن مجرّد بموضع تخصيصه (allocation site)؛ والمتغيرات وحقول الكائنات وعناصر الحاويات وقيم الإرجاع عقد مؤشّرات؛ والإسنادات وقراءة/كتابة الحقول والاستدعاءات (وسيط ← معامل، إرجاع ← نتيجة، متلقٍّ ← self) والتكرار تولّد قيود احتواء تُحلّ حتى نقطة الثبات. يستفيد منه المحرّك في:

  • حلّ الاستدعاءات على الكائنات الفعلية لا على النوع الساكن فقط: دوال مُمرَّرة كمعاملات (callbacks)، دوال تُعاد من مصانع، كائنات محفوظة في قواميس أو قوائم (HANDLERS["sh"].run(...)).

  • التسمية المستعارة في الذاكرة (heap aliasing): تلوّث يُخزَّن في حقل كائن يظهر عبر كل أسمائه المستعارة في أي دالة، حتى عبر المتغيرات العامة والحاويات (STORE.append(t) في دالة، وos.system(t.cmd) في أخرى).

  • فصل مواضع التخصيص: Task() ملوّثة في دالة وTask() نظيفة في أخرى تبقيان كائنين مختلفين.

  • حساسية السياق: تُستنسخ عقد الدالة وكائناتها لكل موضع استدعاء (k = 1)، فمصنع يُستدعى من موضعين يُعيد كائنين مختلفين، وcallback مُمرَّر كمعامل يُحلّ لكل موضع استدعاء على حدة: run_all(shell, t) تُبلَّغ وrun_all(logger, t) لا تُبلَّغ، بدل اتحاد كل الدوال التي مرّت يومًا عبر ذلك المعامل.

التحليل غير حسّاس للتدفق، وحساسيته للسياق بعمق استدعاء واحد (k = 1) مع حدّ أقصى للسياقات لكل دالة حفاظًا على الزمن، بينما تبقى حساسية السياق لتدفق التلوّث نفسه عبر ملخّصات الدوال، فتُبلَّغ النتيجة في موضع الاستدعاء الملوّث.

12 لغة بنفس محرّك تدفق البيانات: Python، JavaScript/TypeScript، Java، Kotlin، C#، Go، PHP، C/C++، Rust، Swift، Ruby، PL/SQL

المحرّك يعمل على شكل البرنامج لا على لغته، لذا تدعم الأداة JavaScript وTypeScript عبر واجهة أمامية (vulnscan/js_frontend.py) تحلّل الكود بمحلّل متسامح خاص بها (بلا أي اعتمادية) وتُنزّله إلى الشجرة نفسها التي يفهمها المحرّك، فتحصل تلقائيًا على كل ما سبق: إدراك الأنواع، عبر الملفات، الحقول، حواجز التحقق، ومسار التدفق.

  • ما يُفهم: ES2020+ (الاستيراد والتصدير وrequire، الأسهم، القوالب النصية، التفكيك، الأصناف، async/await، التسلسل الاختياري) وTypeScript (التعليقات النوعية تُتجاهل، والمُزخرِفات وخصائص معاملات المُنشئ تُحفظ، وinterface/type/enum تُتخطّى).
  • نماذج Node والمتصفح في vulnscan/models/javascript.json: مصادر Express/Koa/Lambda (req.query/body/params، event، process.argv، location، document.cookie)، ونقاط دخول (app.get(...)، NestJS @Get()، exports.handler)، ونقاط خطر child_process، fs، res.send، innerHTML، axios/fetch (SSRF)، res.redirect، require الديناميكي، قوالب EJS/Pug/Handlebars، واستعلامات query/raw/$queryRawUnsafe.
  • أسماء الاستيراد تُحلّ (const cp = require('child_process') فيُفهم cp.exec)، والملفات النسبية (require('./lib/shell')) تُربط عبر المشروع.
  • الملفات المضغوطة (*.min.js) وتعريفات الأنواع (*.d.ts) والحزم الضخمة تُتخطّى.
  • Java وKotlin وC# وGo وPHP عبر واجهة أمامية لعائلة C (vulnscan/cfamily_frontend.py) بالمنهج نفسه: دوال وأصناف وحقول (مع this الضمني في Java/Kotlin/C#)، الاستيرادات (import/using/use/حزم Go)، المُزخرِفات والسمات (@GetMapping، [HttpGet]، #[Route])، الاستيفاء النصي ("$x"، $"{x}")، معاملات مُنشئ Kotlin كحقول مُعنوَنة، أساليب المستقبِل في Go، والمتغيرات الفائقة في PHP. نماذج لكل لغة في vulnscan/models/ (Servlet/Spring/JDBC، Ktor/Spring، ASP.NET/EF، net/http/gin/database/sql، PDO/mysqli/Laravel/Symfony).
// lib/shell.js
const cp = require('child_process');
function run(c) { cp.execSync(c); }        // وسيط يصل إلى أمر shell
module.exports = { run };
// server.js
const { run } = require('./lib/shell');
app.post('/x', (req, res) => { run(req.body.c); });   // ← يُبلَّغ عنه عبر الملفين

Oracle APEX وPL/SQL والمساعد الذكي

يفحص كاشِف كود قاعدة بيانات Oracle وتطبيقات APEX من المصدر، لا من الموقع فقط. ضع ملفات التصدير والحزم في مجلد وافحصه:

kashif ./my-apex-app        # f100.sql أو application/pages/*.sql، وملفات .pkb/.pks/.sql/.trg
ما يُحلَّل كيف
PL/SQL (.sql .pkb .pks .pls .prc .fnc .trg …) الحزم والإجراءات والدوال والمشغّلات والكتل المجهولة، بتحليل تدفق البيانات نفسه عبر الحزم والملفات، مع الوسائط المسمّاة p_x => v.
ملف تصدير APEX (تطبيق كامل أو صفحة أو إضافة) يُستخرج كل كود من داخل استدعاءات wwv_flow_imp_page.create_…: العمليات، ومناطق PL/SQL، و"دالة تُعيد استعلام SQL"، والتحققات والحسابات والشروط، والإجراءات الديناميكية، ورمز الإضافات، وملفات JavaScript المضمّنة بالترميز الست عشري. كل نتيجة تشير إلى سطرها في ملف التصدير وإلى مكوّنها: «صفحة 10 › عملية: Save». وسكربتات التثبيت والترقية وإزالة التثبيت في كائنات الدعم (Supporting Objects، create_install_script وp_deinstall_script_clob) تُستخرج كذلك (صيغة wwv_flow_string.join وwwv_flow_utilities.join في APEX 5.0 وvarchar2_to_clob في APEX 24.1+، والصيغ الأقدم: نص واحد بهروب ''، وunistr('\000a')، و`s := s
تصدير APEX المقروء (YAML) مجلد readable/ (APEX 23.2+): تُقرأ الخصائص النصية (pl/sql-code، sql-query، pl/sql-function-body-returning-sql-query، كود JavaScript، تعليمات الذكاء الاصطناعي) من سطرها، وتُنسب إلى المكوّن من عناوين # ====== Region: …، ويُكشف escape-special-characters: false. وتُقرأ منه مخططات التفويض (الصفحة والمكوّن والمنطقة الأم والتطبيق، ويُذكر زر when-button-pressed ومخططه دون أن يُعدّ حماية) لسياق APX024؛ وإن فُحص التطبيق نفسه بصيغتيه (.sql وreadable/) لا تتكرر النتائج ولا مواضع الاستدعاء (المطابقة برقم التطبيق، ويُؤخذ لملف YAML من أقرب ملف f<id>.yaml فوقه في أي مجلد، وبالمكوّن والقاعدة وسطر الكود المُبلَّغ عنه؛ وإن لم يُعرف رقم التطبيق فلا مطابقة إلا إن كان في الفحص تطبيق .sql واحد).
معالجات ORDS ORDS.DEFINE_HANDLER / DEFINE_SERVICE حيثما وُجدت: في .sql، وداخل سجلات Liquibase/SQLcl بصيغة XML (runOracleScript و CDATA)، وفي تعريفات REST بصيغة JSON. معالجات PL/SQL تُحلَّل ككود، ومعالجات الاستعلام كـ SQL، ومتغيرات الربط (:id و:body_text…) مصادر، و:forward_location نقطة تحويل.
دوال داخل SQL الثابت الاستعلامات الثابتة في التقارير وقوائم القيم ومعالجات ORDS، وجمل SELECT/INSERT/UPDATE/DELETE/MERGE والمؤشرات داخل PL/SQL: متغير الربط آمن لـ SQL، لكن الدالة التي تستقبله تُتتبَّع، فإن بنت به SQL ديناميكيًا يُبلَّغ عنه.
Java داخل قاعدة البيانات كتل create … java source تُحلَّل بواجهة Java، و«call spec» (as language java name '…') يُربط بالدالة، فيُكشف التدفق من عنصر الصفحة عبر PL/SQL إلى Runtime.exec في Java.

المصادر: عناصر الصفحة :P1_X وv('P1_X') وnv() وapex_util.get_session_state()، وapex_application.g_x01…g_f50، وقيم الإضافات p_item.value وp_param.value، وowa_util.get_cgi_env وapex_json. نقاط الخطر: EXECUTE IMMEDIATE وOPEN … FOR وDBMS_SQL.PARSE وapex_exec وapex_collection.create_collection_from_query، وhtp.p، وowa_util.redirect_url، وapex_web_service/utl_http، وutl_file، وdbms_ldap، وdbms_scheduler/dbms_job. المعقّمات: USING (متغيرات الربط) وDBMS_ASSERT وapex_escape وhtf.escape_sc.

قواعد خاصة بـ APEX لا تحتاج تدفق بيانات:

القاعدة المشكلة
APX001 سلسلة استبدال &P1_X. داخل SQL أو PL/SQL — تُستبدل نصيًا قبل التنفيذ فتسمح بالحقن.
APX002 &P1_X. داخل JavaScript دون المرشّح !JS.
APX003 &P1_X!RAW. في HTML.
APX004 تهريب المخرجات معطّل لعمود أو عنصر (WITHOUT_MODIFICATION).
APX005 عنصر يتحكم به المستخدم يُستبدل داخل تعليمات المساعد الذكي (إعداد AI في APEX 24).

فحص إعدادات أمان التطبيق (على نهج APEX Advisor وAPEX-SERT، من ملف التصدير بصيغتيه SQL وYAML):

القاعدة الإعداد
APX006 حماية حالة الجلسة (Session State Protection) معطّلة
APX007 Rejoin Sessions لكل الجلسات
APX008 السماح بالتضمين في إطار من أي موقع
APX009 روابط تعديل المطوّر في بيئة التشغيل
APX010 checksum بـ MD5/SHA1
APX011 تهريب HTML أساسي
APX012 Runtime API تعدّل التطبيقات
APX013 كوكي المصادقة دون Secure
APX014 مخطط «بلا مصادقة»
APX015 كلمة مرور تُقارن كنص صريح (المصادقة المخصصة والحزم)
APX016 صفحة عامة تعدّل البيانات (تُستثنى عمليات صفحة الدخول التي لا تكتب في الجداول)
APX017 صفحة تعدّل البيانات بلا مخطط تفويض
APX018 حماية الوصول للصفحة غير مقيّدة
APX019 عنصر مخفي قيمته غير محمية
APX020 عملية AJAX عند الطلب بلا تفويض
APX021 الاستبدال دون النقطة الختامية
APX022 وحدة PL/SQL ملفوفة (wrapped): تُذكر مرة واحدة ولا يُفحص نصّها (معلوماتية)
APX023 إضافة (Plug-in) معرَّفة لا يستخدمها أي مكوّن في التطبيق؛ وتُخفَّض خطورة ما يوجد داخلها درجة واحدة
APX024 روتين عام في حزمة PL/SQL يصل إلى البيانات دون تحقق من الصلاحية بينما تتحقق منها معظم الروتينات الشقيقة بالاستدعاء نفسه (CWE-862، ثقة محتملة). يتتبّع المسارات داخل الروتين: يُبلَّغ أيضًا عن تحقق لا يسبق كل مسار إلى البيانات (في فرع واحد من IF/CASE أو من $if للترجمة الشرطية، أو داخل حلقة، أو في معالج استثناء، أو بعد الوصول، أو دالة تحقق لا يُختبر جوابها)، أما if not can_view(…) then raise_application_error(…); end if; قبل الوصول فيكفي، وكذلك = false و!= true وnot (…) وnvl(…, false) = false وcase when not …، وفي المقارنة بعدد: > 0 و>= 1 و= 1 تعني النجاح، و<= 0 و= 0 و< 1 تعني الفشل، أما >= 0 و< 0 و> 1 و<= 1 فلا تقول شيئًا؛ بينما not can_view(…) and x لا يكفي، ولا يُحتسب إلا استدعاء التحقق نفسه أو متغير يحمل جوابه أو nvl لأحدهما بقيمة فشل (FALSE أو 0 أو 'N')، فلا يكفي nvl(…, 'Y') ولا greatest(…) ولا الحساب ولا decode(…). ولا يُعدّ روتين في الحزمة تحققًا (حتى إن دلّ اسمه على ذلك) إلا إن مرّت كل مساراته إلى نهايته الناجحة بالتحقق. ويُعدّ الحارس كما في 1.3 (استدعاؤه قبل أول وصول إلى البيانات في النص)، وتذكر الرسالة كم من الروتينات الشقيقة يغطي كل المسارات؛ يعمل على ملفات .pkb/.pks/.sql وعلى الحزم في كائنات الدعم داخل ملف التصدير. وإن كان في الفحص تصدير APEX يستدعي الروتين (عملية صفحة، مصدر منطقة، عملية AJAX أو عملية تطبيق، كود خادم لإجراء ديناميكي…) تذكر النتيجة مواضع الاستدعاء (بالاسم pkg.routine أو باسم المخطط قبله أو عبر مرادف SYNONYM معرَّف في الكود المفحوص، أو في execute immediate بنص ثابت، أو عملية Invoke API، أو بشكل غير مباشر عبر روتين حزمة آخر يستدعيه دون تحقق؛ التعليقات والنصوص الأخرى ليست استدعاءً) ومخططات التفويض (على المكوّن، أو الموروثة من المنطقة الأم وما فوقها لما يُعرض داخلها فقط: العناصر والأعمدة والأزرار والمناطق الفرعية، لا عمليات الصفحة ولا التحققات ولا التفرعات لأنها تعمل عند الإرسال أيًّا كان ما عُرض، ومن حدث الإجراء الديناميكي؛ أو على الصفحة أو التطبيق؛ لا تُقيَّم شروط الخادم، ولا يُعدّ مخطط الزر حمايةً للعملية التي تعمل عند الضغط عليه، لأن إرسال الصفحة بطلب يحمل اسم الزر ممكن ولو لم يُعرض، فتذكر الرسالة الزر ومخططه؛ لا يُحسب MUST_NOT_BE_PUBLIC_USER ولا المخطط المنفي !): إن كانت كلها محمية تبقى النتيجة بخطورتها وتذكر أن الحماية لا تشمل أي مستدعٍ آخر للحزمة (صفحة أو تطبيق آخر أو صلاحية EXECUTE مباشرة)، وإن كان أحدها غير محمي (صفحة عامة، أو مكوّن أو عملية تطبيق بلا مخطط) تسمّيه بسطره وتُرفع الخطورة إلى عالية

أسماء الخصائص ومعانيها مأخوذة من ملفات تصدير أوراكل الرسمية نفسها، وقد جُرّبت الفحوص عليها.

ثغرات المساعد الذكي (apex_ai وdbms_cloud_ai / Select AI وdbms_vector_chain):

القاعدة المشكلة
DF019 بيانات المستخدم تصل إلى p_system_prompt — حقن التعليمات.
DF020 حرج نص يولّده النموذج يُنفَّذ كـ SQL أو كود (execute immediate على مخرجات apex_ai.generate).
DF021 مخرجات النموذج تُكتب في الصفحة دون تهريب (XSS عبر النموذج).
DF022 نص المستخدم يقود توليد SQL عبر Select AI — يُنبّه لتقييد ملف التعريف وصلاحيات التنفيذ.

الحقن من الدرجة الثانية وXSS المخزّن (DF023 وDF024): يتتبّع كاشِف الجداول نفسها. حين يكتب INSERT أو UPDATE أو INSERT … SELECT، أو نموذج APEX يحفظ عناصره تلقائيًا (Form Region / Automatic Row Processing)، قيمةً من المستخدم في جدول.عمود، تصير كل قراءة لذلك العمود (SELECT … INTO، وحقول صفوف حلقات المؤشر، وFETCH) مصدرًا ملوّثًا في أي ملف. يُعاد التحليل حتى الاستقرار فتُتبع النُسخ من جدول إلى آخر. الأعمدة التي لا يكتب فيها المستخدم لا تُبلَّغ عنها، والنتيجة تذكر أين كُتبت القيمة: «بيانات مخزّنة في NOTES.BODY (كتبها مستخدم في f300.sql:19)».

تعريفات REST بصيغة JSON: تُقرأ صيغتان معروفتان: الوحدة المتداخلة (templates → handlers)، وتصدير جداول ORDS الوصفية (USER_ORDS_MODULES و_TEMPLATES و_HANDLERS، كما يصدّرها SQL Developer) مع ربط المعالج بنمطه ووحدته عبر المعرّفات. وفي أي ملف JSON آخر، كل قيمة نصية هي كتلة PL/SQL كاملة (begin … ; … end;) تُحلَّل ككود أيًّا كان اسم مفتاحها، وتُنسب النتيجة إلى مسارها داخل الملف (JSON › $.steps[0].plsqlBody).

الحقن من الدرجة الثانية في كل اللغات

الآلية نفسها (الكتابة في جدول.عمود ثم قراءته مصدرًا) تعمل على كل اللغات، لأنها تجري على الشجرة المشتركة بعد الواجهات الأمامية:

النوع ما يُفهم
SQL خام بمتغيرات ربط ? و%s و%(name)s و$1 و:name و@name: cur.execute(sql, params)، db.query(sql, [..])، db.Exec(sql, a)، JDBC prepareStatement + setString(1, x) + executeQuery/ResultSet، PDO prepare + execute([..])/bindParam، mysqli bind_param، ADO.NET SqlCommand + Parameters.AddWithValue، db.prepare(sql).run(a)، وrow.Scan(&x) في Go.
ORM Django وSQLAlchemy وPeewee وSQLModel، وActiveRecord، وMongoose وSequelize وPrisma وTypeORM، وJPA/Hibernate (@Entity مع setters/getters ومستودعات Spring Data بالاسم). الكتابة: create/update/المُنشئ/obj.f = x/setF(x)؛ القراءة: حقول الكائن المجلوب أو متغير الحلقة.

ما يعود من قاعدة البيانات يحمل تلوّث الأعمدة فقط، لا تلوّث مفتاح البحث: Msg.findById(req.params.id).who ليس ملوّثًا إلا إن كتب مستخدمٌ في MSG.WHO.

أسماء الجداول الحقيقية: يُحسب جدول كل صنف ORM كما يحسبه إطاره: __tablename__ (SQLAlchemy)، وMeta.db_table أو <app>_<model> الافتراضي (Django)، وself.table_name (Rails)، و@Table(name=…)/@Entity("…") (JPA/TypeORM)، ومجموعة Mongoose في الوسيط الثالث، وtableName في Sequelize. ثم تُوحَّد كل الأسماء بصيغة قانونية (بلا مخطط، مفرد، وأسماء الأعمدة بلا شرطات: created_at = createdAt)، فجدول notes في SQL الخام وصنف Note في ORM جدول واحد.

الدوال الوسيطة العامة: دالة تأخذ الجدول أو الصنف والبيانات كوسائط، مثل save(table, data) التي تبني INSERT INTO {table}، أو create(Model, **fields)، أو createRecord(Model, data)، أو fetch(table, id)، تُكتشف تلقائيًا، وتُنمذج الكتابة والقراءة عند كل استدعاء بالجدول والمفاتيح الفعلية. ومفاتيح قاموس حرفي ثابت لا تُعدّ مدخلات مستخدم، أما مفاتيح request.form فتبقى ملوّثة.

نصوص SQL غير الحرفية: يُقيَّم نص الاستعلام قبل تحليله: الثوابت على مستوى المشروع، وq += … المتتابعة، وformat و% وjoin والقوالب النصية، ودوال المشروع التي تبني الاستعلام من وسائطها. واسم الجدول المقروء من الإعدادات يُحلّ من ملفات المشروع: .env و.ini/.cfg و.properties و.json و.yaml و.toml، عبر os.getenv وos.environ وprocess.env وsettings.X وconfig["a"]["b"] وENV[...] وSystem.getenv و@Value("${…}") في Spring. وتُقرأ متغيرات البيئة من ملفات النشر أيضًا: Dockerfile وdocker-compose وKubernetes وHelm وGitHub Actions وapp.json. والقيمة المعرّفة في ملفات المشروع إعدادٌ يتحكم به المشغّل فلا تُعامل كمدخل مستخدم، أما المتغير غير المعرّف فيبقى مصدرًا.

جدول يُحدَّد وقت التشغيل: حين لا يمكن معرفة الجدول من الملفات أصلًا (اسمه يُقرأ من القاعدة نفسها أو من خدمة خارجية)، يُربط الحفظ بالقراءة عبر اسم العمود: كتابة المستخدم في العمود COMMENT لجدول مجهول تجعل قراءة COMMENT مصدرًا محتملًا. تظهر هذه النتائج بخطورة أقل درجة وبوصف صريح «الجدول يُحدَّد وقت التشغيل (الربط باسم العمود)».

VQL — لغة استعلام فوق قاعدة بيانات البرنامج

على نهج from … where … select في CodeQL، تبني الأداة قاعدة بيانات علاقية للبرنامج (الاستدعاءات، الدوال، الأصناف، الإسنادات، السلاسل، الاستيرادات، المُزخرِفات، السمات، وتدفقات محرّك التلوّث) وتشغّل عليها استعلامات تصريحية. عشرة استعلامات مدمجة في vulnscan/queries/ (منها: تعطيل التحقق من TLS، yaml.load بلا Loader، JWT ضعيف، CORS بنجمة، نقطة دخول بلا مصادقة، عشوائية غير مشفّرة لسر، SQL مُركّب نصيًا)، وتضيف استعلاماتك بـ --query DIR:

// @id vql/tls-verify-disabled
// @name TLS certificate verification disabled
// @severity high
// @cwe CWE-295
// @advice فعّل التحقق من الشهادة.
from call c
where c.name matches "^(requests|httpx)\." and c.kwargs contains "verify=False"
select c, "TLS verification disabled in " + c.name
  • العلاقات: call (name, func, receiver, args, arg0..arg3, kwargs, in_func, in_class…)، func (name, qual, decorators, is_entry, is_method…)، class، assign (target, value)، string، import، decorator، attr، وflow (rule, severity, source, callee, interprocedural, hops, sink_file, sink_line) لنتائج تدفق البيانات.

  • المعاملات: = != < > <= >= matches (regex) contains in (…) and or not والأقواس، وربط عدة علاقات في from بشروط مساواة، و+ لتركيب الرسالة.

  • kashif --list-rules . يعرض الاستعلامات مع القواعد، وتظهر نتائجها بمصدر vql.

  • مسندات يعرّفها المستخدم مع استدعاء ذاتي (Datalog): predicate بعدة فقرات تفصلها or، ومتغيرات حرّة value x تُربط بالضمّ على صفوف المسند، وتقييم تصاعدي حتى نقطة الثبات، فتُكتب الإغلاقات المتعدية مباشرة:

predicate calls(f, g)   { from call c where c.in_func = f and c.func = g }
predicate reaches(f, g) { calls(f, g) or from value h where calls(f, h) and reaches(h, g) }
from func e where e.is_entry and reaches(e.name, "system") select e, "يصل إلى أمر shell"

والاستعلام المدمج vql/entry-reaches-shell يستخدمها لرصد نقاط الدخول التي تصل إلى أوامر shell عبر مخطط الاستدعاءات.

بصدق: VQL تدعم الآن الأصناف (بمسند مميِّز ومسندات أعضاء وجوالب) والمسندات الذاتية والتجميعات (count/strictcount/sum/max/min/avg وexists/any)؛ تبقى مجموعة عملية واسعة من QL دون نظام الوحدات/الاستيراد والأنواع المَعلَمة والمكتبة المعيارية الكاملة.

فحص تطبيقات الويب وصفحاتها (الزحف وبصمة المنصّات)

لفحص تطبيق ويب متعدد الصفحات مثل بوابة جامعة أو نظام Moodle أو تطبيق Oracle APEX، أضِف --crawl: تتبع الأداة روابط الصفحات من الأصل نفسه (المخطط والمضيف والمنفذ أنفسها) زحفًا بالعرض (BFS) وتفحص كل صفحة بالفحوص السلبية.

kashif https://lms.jamiah.example --authorized --crawl --deep
  • حدود الزحف: --max-pages (الافتراضي 20، والحد الأعلى 500) و--max-depth (الافتراضي 2). لا تُتبع روابط الخروج/الحذف (logout، delete…) ولا الروابط الخارجة عن الأصل، ولا تُرسَل أي بيانات.
  • بصمة المنصّة: تتعرّف الأداة تلقائيًا على Moodle وOracle APEX وWordPress وJoomla وDrupal وphpMyAdmin وLaravel من الصفحة والترويسات، وتنبّه إذا كان الإصدار المكتشف به ثغرات معروفة (WEB800) أو انتهى دعمه (WEB801). ومع --deep تجلب مرة واحدة بطلب GET عادي مسارات الإدارة والدخول المعروفة للمنصّة المكتشفة (مثل /login/index.php و/wp-login.php و/administrator/) دون إرسال أي بيانات إليها، مع القائمة الثابتة من الملفات المكشوفة الشائعة.

⚠️ الزحف وفحص الويب يتطلبان --authorized. افحص فقط الأنظمة التي تملكها أو لديك تصريح كتابي بفحصها — فحص بوابة جامعة أو أي نظام لا تملكه دون إذن قد يكون مخالفًا للقانون.

فك تجميع APK / JAR / AAR / DEX (jadx)

إذا كان jadx مثبّتًا (يحتاج Java 11+)، تُفكّ تجميع الحزم الثنائية تلقائيًا إلى كود Java مع فك ترميز AndroidManifest.xml والموارد، وتُطبَّق عليها كل القواعد (تنفيذ الأوامر، الأسرار، التشفير الضعيف، WebView، cleartext…). تظهر هذه النتائج بمسار app.apk!decompiled/… وبعلامة jadx.

  • مكتبات الطرف الثالث الشائعة (androidx، kotlin، okhttp، firebase…) تُستبعد افتراضيًا لتقليل الضجيج؛ فعّل فحصها بـ --jadx-include-libs أو من الإعدادات.
  • بدون jadx تُفحص الملفات النصية داخل الحزمة فقط ويظهر تنبيه بذلك في التقرير.
  • خيارات: --no-jadx، --jadx-timeout SEC (الافتراضي 600).

التثبيت: نزّل jadx-x.y.z.zip من صفحة الإصدارات وأضف مجلد bin إلى PATH، أو: brew install jadx (macOS) · scoop install jadx / choco install jadx (Windows) · sudo apt install jadx (Debian/Ubuntu).

بالإضافة إلى ذلك، وعند توفر الإنترنت:

  • ثغرات الاعتماديات المعروفة (CVE) عبر OSV.dev من requirements.txt، package-lock.json، package.json، pubspec.lock، go.mod، Gemfile.lock، composer.lock.
  • دمج أدوات خارجية إن كانت مثبّتة (اختياري تمامًا): bandit، semgrep، gitleaks، npm audit.

التثبيت

pip install git+https://github.com/abdulrahmanahmedelabed-prog/vulnscan

أو بدون تثبيت:

git clone https://github.com/abdulrahmanahmedelabed-prog/vulnscan
cd vulnscan
python -m vulnscan /path/to/project

التثبيت بسطر واحد (مع التحقق من SHA-256)

# macOS ولينكس
curl -fsSL https://abdulrahmanahmedelabed-prog.github.io/vulnscan/install.sh | sh
# Homebrew
brew tap kashif/vulnscan https://github.com/abdulrahmanahmedelabed-prog/vulnscan && brew install kashif
# ويندوز
irm https://abdulrahmanahmedelabed-prog.github.io/vulnscan/install.ps1 | iex

تنزّل الطرق الثلاث النسخة الرسمية وتطابقها مع SHA256SUMS.txt قبل التثبيت، ولأنها تنزّل بـ curl فلا يضع macOS علامة الحجر على الملف فلا يمنعه Gatekeeper.

داخل محرر الكود وطلبات الدمج

  • محرّرات الكود: kashif lsp خادم لغة (LSP) يضع خطًا تحت الثغرات أثناء الكتابة مع مسار تدفق البيانات وطريقة الإصلاح وإصلاحات سريعة (كتم نتيجة مُراجَعة أو إضافتها لخط الأساس). إضافة VS Code مرفقة بكل إصدار (kashif-vscode.vsix)، ويعمل الخادم نفسه مع JetBrains وNeovim وHelix وZed وSublime وEmacs (الإعداد في editors/README.md).
  • طلبات الدمج: إجراء GitHub يعلّق على الأسطر المتغيّرة فقط ويحدّث تعليق ملخّص واحد، و--diff-base origin/main لفحص ما أضافه الفرع فقط، وتقارير GitLab (-f gitlab-sast و-f codeclimate)، وخطّاف pre-commit (الدليل في docs/integrations.md).

نسخ جاهزة (بلا تثبيت Python)

نزّل الملف من صفحة الإصدارات:

النظام الملف
ويندوز x64 (ملف واحد) kashif-windows-x86_64.exe — انقر مرّتين لفتح الواجهة
ويندوز x64 (مثبّت) kashif-setup.exe — يثبّت كاشِف ويضيفه إلى PATH (اختياري) مع اختصار في قائمة ابدأ وعلى سطح المكتب، ويُزال من إعدادات ويندوز
لينكس x86-64 kashif-linux-x86_64 — Ubuntu 22.04 وDebian 12 وRHEL 9 أو أحدث
macOS (Apple Silicon) kashif-macos-arm64
macOS (Intel) kashif-macos-x86_64

على لينكس:

chmod +x kashif-linux-x86_64
./kashif-linux-x86_64                       # يفتح الواجهة
./kashif-linux-x86_64 ./project --fail-on high   # سطر الأوامر

على macOS: الملف غير موثَّق (notarized) من Apple، فأزل علامة الحجر مرة واحدة قبل أول تشغيل (أو انقر على الملف بالزر الأيمن ← Open):

chmod +x kashif-macos-arm64
xattr -d com.apple.quarantine kashif-macos-arm64
./kashif-macos-arm64

كل إصدار يرفق SHA256SUMS.txt للتحقق من سلامة الملفات (sha256sum -c SHA256SUMS.txt --ignore-missing)، وقائمة مكوّنات CycloneDX ‏(kashif-sbom.cdx.json)، ومصدر بناء SLSA موقَّعًا يُتحقَّق منه بـ:

gh attestation verify kashif-linux-x86_64 --repo abdulrahmanahmedelabed-prog/vulnscan

النسخة تُبنى آليًا عبر GitHub Actions بواسطة PyInstaller من ملف vulnscan.spec، وتتضمن الواجهة كاملة. لبنائها محليًا: pip install pyinstaller ثم pyinstaller --clean --noconfirm vulnscan.spec (الناتج في dist/).

صفحة الهبوط: موقع تعريفي في site/ يُنشر على GitHub Pages ويتضمن المقارنة مع الأدوات العالمية.

التحديث

النسخ الجاهزة تحدّث نفسها: من الواجهة افتح الإعدادات ← التحديثات واضغط حدّث الآن ثم أعد التشغيل الآن، وتظهر شارة «تحديث متاح» في الشريط الجانبي عند صدور إصدار أحدث. ومن سطر الأوامر:

kashif update            # تحقّق، ثم أكّد، ثم نزّل وتحقّق وثبّت
kashif update --check    # تحقّق فقط: رمز الخروج 10 عند توفّر تحديث و0 إن كنت على أحدث إصدار
kashif update --yes      # دون سؤال للتأكيد (للسكربتات)

يُنزَّل التحديث من GitHub فقط عبر HTTPS، ويُطابَق مع SHA256SUMS.txt المنشور مع الإصدار، ويُرفض إن لم يكن أحدث، ويُجرَّب (--version) قبل أن يحلّ محلّ البرنامج دفعة واحدة؛ وتبقى النسخة السابقة باسم <الاسم>.old حتى التشغيل القادم، وأي فشل يعيدها كما كانت. على macOS تُعرض النسخة الأصلية لـ Apple Silicon على نسخة Intel العاملة عبر Rosetta. إن لم يكن مجلد البرنامج قابلًا للكتابة (مثل /usr/local/bin) فشغّل sudo kashif update. أما تثبيت pip أو الكود المصدري فلا يُعدَّل أبدًا: تعرض الواجهة وkashif update الأمر المناسب بدلًا من ذلك. يسأل التحقق api.github.com عن أحدث إصدار مرة كل 6 ساعات على الأكثر ولا يرسل شيئًا عن الكود؛ ويمكن إيقافه من خيار التحقق من التحديثات تلقائيًا في الإعدادات.

التثبيت عبر pip قبل الإصدار 1.0.2 يحمل اسم التوزيعة vulnscan (وصار اسمها kashif منذ 1.0.2)، فأزِله قبل تثبيت الإصدار الجديد وإلا امتلكت التوزيعتان الملفات نفسها (أما vulnscan على PyPI فمشروع آخر لا علاقة له بكاشِف):

python -m pip uninstall -y vulnscan kashif
pip install git+https://github.com/abdulrahmanahmedelabed-prog/vulnscan

التشغيل بنقرة واحدة

بعد تنزيل المشروع وفكّ ضغطه، وتثبيت Python 3 (على ويندوز فعّل خيار Add Python to PATH):

النظام الملف
ويندوز انقر مرّتين على run.bat
macOS انقر مرّتين على run.command
لينكس شغّل ./run.sh

يفتح المتصفح تلقائيًا على الواجهة. اترك النافذة مفتوحة، وللإيقاف اضغط Ctrl+C.

الواجهة الرسومية

kashif ui

يفتح المتصفح على http://127.0.0.1:8765 (الخادم يستمع على هذا الجهاز فقط ولا يُعرَّض للشبكة):

  • لوحة التحكم: بطاقات العدّ لكل خطورة، مخطط دائري للتوزيع، اتجاه النتائج عبر الفحوصات الأخيرة، أكثر الثغرات تكرارًا، أكثر الملفات تأثرًا، وآخر الفحوصات.
  • فحص جديد: مسار مجلد/ملف/أرشيف على الجهاز، أو رفع (سحب وإفلات) أي برنامج مضغوط (zip / apk / jar / aar / war / whl / ipa / tar.gz) أو أي عدد من الملفات أو مجلد كامل من المتصفح، أو عنوان ويب مع إقرار الصلاحية. تُحذف الملفات المرفوعة بعد الفحص.
  • النتائج: مرتبة من الأعلى خطورة إلى الأقل، مع فلاتر بالخطورة والمصدر وبحث نصي، وبطاقة لكل نتيجة تُفتح لعرض المقتطف وCWE وطريقة الإصلاح، وتنزيل Markdown / JSON / HTML.
  • التقارير: سجل الفحوصات، تنزيل التقارير، ومقارنة فحصين لمعرفة ما أُصلح وما استجد.
  • القواعد: استعراض كل القواعد المدمجة مع البحث.
  • الإعدادات: أدنى خطورة، الاستثناءات، القواعد المتجاهَلة، OSV، الأدوات الخارجية، العناوين المصرَّح بها.
  • عربي/إنجليزي، فاتح/داكن/تلقائي، ومتجاوب مع شاشات الجوال.

تُحفظ البيانات في ~/.vulnscan (أو المجلد في VULNSCAN_HOME). خيارات: --port، --no-browser.

الاستخدام من سطر الأوامر

# تقرير ملوّن على الشاشة
kashif ./my-project

# تقارير Markdown + JSON + HTML دفعة واحدة
kashif ./my-project --all-formats report

# تقرير HTML فقط إلى ملف
kashif app.apk -f html -o report.html

# في CI: أفشل البناء إذا وُجد شيء عالٍ أو حرج
kashif . --fail-on high --exclude "tests/*"

# دون إنترنت ودون أدوات خارجية
kashif . --no-deps --no-external

# فحص سلبي لموقع تملكه
kashif https://my-site.example --authorized

# عرض القواعد
kashif --list-rules .

# SARIF لـ GitHub Code Scanning وVS Code
kashif . -f sarif -o vulnscan.sarif

# تبنّي الأداة على كود قائم: احفظ الموجود اليوم، ثم اعرض الجديد فقط
kashif . --write-baseline .vulnscan-baseline.json
kashif . --baseline .vulnscan-baseline.json --fail-on high

# تقارير GitLab: تبويب الأمان وجودة الكود
kashif . -f gitlab-sast -o gl-sast-report.json
kashif . -f codeclimate -o gl-code-quality.json

الأوامر الفرعية

يعرض kashif --help كل الخيارات والأوامر الفرعية، وkashif <أمر> --help خيارات أمر واحد. ويعمل python3 -m vulnscan بالطريقة نفسها، ويبقى vulnscan اسمًا بديلًا لـ kashif.

الأمر ماذا يفعل
kashif ui الواجهة الرسومية المحلية على 127.0.0.1.
kashif lsp خادم لغة للمحررات: الثغرات تحت الكود أثناء الكتابة مع إصلاحات سريعة.
kashif mcp خادم MCP يتيح لـ Claude Code وCursor ووكلاء VS Code وWindsurf وZed فحص الكود الذي يكتبونه محليًا ودون إنترنت: claude mcp add kashif -- kashif mcp.
kashif export report.json -f sonarqube -o sonar.json تحويل تقرير JSON إلى DefectDojo وSonarQube وJUnit وCSV وJira وGitHub Issues وASFF وOCSF وGitLab وCode Climate (kashif export --list-formats).
kashif compliance report.json -f html -o audit.html ربط النتائج بأطر OWASP وASVS وCWE Top 25 وPCI DSS وNIST وISO 27001 وHIPAA وGDPR وتقرير قابل للطباعة للمدقق؛ دليل يدعم التقييم وليس شهادة.
kashif history . كل سرّ أُودِع في تاريخ git ولو حُذف لاحقًا، مع الإيداع الذي أدخله وهل ما زال في HEAD؛ تُخفى قيم الأسرار دائمًا (الاسم البديل secrets-history).
kashif triage list فرز يعيش داخل المستودع (.kashif/triage.json): إنذار كاذب، قبول خطر بتاريخ انتهاء، لن يُصلَح، أُصلِح؛ مع صاحب القرار ومبرّره وسجل تدقيق.
kashif policy check report.json السياسة ككود: بوابة أمان من kashif.yml تشرح كل قرار بالعربية أو الإنجليزية (kashif policy init يكتب ملفًا أوليًا).
kashif surface . خريطة سطح الهجوم: نقاط الدخول ومدخلاتها والمصادقة الظاهرة والمصارف التي تصل إليها، وهيكل OpenAPI 3.1؛ تحليل ساكن فقط.
kashif rules new my-pack اكتب قواعدك واختبرها: new وtest وlint وpack وverify وinstall وlist وdocs؛ وافحص بالحزم المثبّتة عبر --pack NAME أو --packs.
kashif update تثبيت أحدث إصدار رسمي بعد التحقق منه (--check للتحقق فقط).
kashif update-data --web تثبيت بيانات فاحص المواقع من حزمة آخر إصدار رسمي بعد التحقق من بصمتها SHA-256 (--check للتحقق فقط)؛ لا يُرسل شيء عن المواقع التي تفحصها، ودونه تُستخدم البيانات المضمّنة.

التكامل مع GitHub Code Scanning (SARIF)

permissions:
  security-events: write   # يلزم لرفع SARIF
# ...
- run: pip install git+https://github.com/abdulrahmanahmedelabed-prog/vulnscan && vulnscan . --no-deps -f sarif -o vulnscan.sarif
- uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: vulnscan.sarif

تظهر النتائج في تبويب Security ومباشرة على أسطر طلبات الدمج، مع درجة خطورة رقمية وCWE ومسار تدفق البيانات (من المصدر إلى نقطة الخطر). كل نتيجة تحمل بصمة ثابتة لا تتغير بتحريك السطر أو إعادة تنسيقه، فلا تتكرر الإنذارات.

خط الأساس (Baseline)

على كود قائم فيه مئات النتائج القديمة، احفظ بصماتها مرة واحدة بـ --write-baseline واحفظ الملف في المستودع (لا يحوي كودًا، بصمات فقط). بعدها --baseline يكتم المعروف ويعرض الجديد فقط، و--fail-on يُفشل البناء على الجديد وحده. البصمة = القاعدة + الملف + المقتطف بلا مسافات، فتصمد أمام إزاحة الأسطر وإعادة التنسيق.

كشف الأسرار

أنماط مزوّدين محددة (AWS وGitHub وSlack وStripe وGoogle وSendGrid وTwilio وMailgun وnpm وPyPI وDigitalOcean وShopify وSquare وFacebook وTelegram، وروابط Webhook، ومفاتيح حساب خدمة GCP، ومفاتيح Azure Storage)، إضافة إلى كشف بالعشوائية (إنتروبيا شانون) على نهج gitleaks وtrufflehog يلتقط مفاتيح مزوّدين لا نمط لهم، مع تجاهل التجزئات السداسية وقيم الأمثلة وبيانات base64 للصور وتجزئات integrity.

الخيارات

الخيار الوصف
-f console|markdown|json|html|sarif صيغة التقرير (sarif لـ GitHub Code Scanning وVS Code)؛ ويقبل أيضًا صيغ التصدير مثل gitlab-sast وcodeclimate وdefectdojo وsonarqube وjunit وcsv
--export FORMAT=FILE كتابة الفحص نفسه بصيغة تصدير إضافية (يُكرَّر)
--triage[=FILE] / --triage-update / --triage-show STATUSES تطبيق قرارات الفرز / حفظ ما تغيّر (للفرع الرئيسي فقط) / الحالات المعروضة
--sla SPEC / --fail-on-sla مهلة الإصلاح لكل خطورة / رمز خروج 1 عند تجاوزها
--policy[=FILE] / --no-policy / --policy-reports-dir DIR بوابة السياسة (يُطبَّق kashif.yml الموجود في المجلد تلقائيًا) / تعطيلها / مجلد تقاريرها
--compliance FRAMEWORKS / --audit-report FILE ملخص الامتثال بعد التقرير / تقرير المدقق HTML
--risk-score درجة خطر كاشِف للمشروع (0-10؛ ليست درجة CVSS)
--pack NAME / --packs استخدام حزمة قواعد مثبّتة / كل الحزم
--baseline FILE / --write-baseline FILE اعرض الجديد فقط مقارنة بخط أساس / احفظ خط الأساس
-o FILE كتابة التقرير إلى ملف
--all-formats PREFIX كتابة PREFIX.md و PREFIX.json و PREFIX.html و PREFIX.sarif
--min-severity LEVEL عرض هذه الخطورة فما فوق
--fail-on LEVEL رمز خروج 1 عند وجود نتيجة بهذه الخطورة أو أعلى
--exclude GLOB استثناء مسارات (يُكرَّر)
--ignore-rule ID تجاهل قاعدة (يُكرَّر)
--no-deps / --no-external تعطيل OSV / الأدوات الخارجية
--no-jadx / --jadx-timeout SEC / --jadx-include-libs التحكم في فك التجميع عبر jadx
--authorized إقرار بالصلاحية (إلزامي لعناوين الويب)
--deep فحص ويب أعمق (تحليل الصفحة ومسارات مكشوفة شائعة)
--crawl / --max-pages / --max-depth زحف على صفحات الموقع وفحصها (لتطبيقات مثل Moodle وAPEX)

كتم إنذار مقصود

أضف في نهاية السطر # nosec أو // vulnscan: ignore. ولكتم ملف كامل ضع vulnscan: ignore-file في أول سطوره.

شكل التقرير

Kashif — ./my-project  (156 ملفًا مفحوصًا، 37 نتيجة)

الملخص (من الأعلى خطورة إلى الأقل):
        حرج  CRITICAL 0
       عالٍ  HIGH     3
      متوسط  MEDIUM   8
      منخفض  LOW      26
   معلوماتي  INFO     0

━━ عالٍ / HIGH (3) ━━
  🟧 MOB001 [CWE-319] السماح بحركة مرور غير مشفّرة — Cleartext traffic allowed
     📄 app/android/app/src/main/AndroidManifest.xml:6
     ▸ android:usesCleartextTraffic="true"
     💡 عطّل cleartext واستخدم HTTPS فقط …

تقرير Markdown يبدأ بملخص تنفيذي وجدول أعداد، ثم «أهم ما يجب إصلاحه أولًا»، ثم كل النتائج مجمّعة حسب الخطورة مع المعرّف و CWE والموضع والمقتطف وطريقة الإصلاح. تقرير JSON يحمل الحقول نفسها لدمجه في أدوات أخرى.

الدقة: OWASP Benchmark

نقيس كاشِف على مجموعتي OWASP Benchmark الرسميتين بطريقة OWASP في الحساب (متوسط معدّل الإيجابيات الصحيحة ناقص معدّل الإيجابيات الكاذبة لكل فئة)، بأداة التقييم الخاصة بالمشروع (bench/score_owasp.py) لا بأداة Scorecard الرسمية: Python ‏93.1% (1,230 حالة؛ كانت 74.0% في 1.1.1 و90.2% في 1.2.0) وJava ‏98.3% (2,740 حالة؛ كانت 76.3% في 0.9). تُفحص كل مجموعة كاملة كتطبيق واحد بالملف الافتراضي، ولا يحوي المحرّك أي اسم أو مسار أو نتيجة من ملفات الاختبار.

قفزة Java سببها إصلاحان عامّان في حلّ الاستدعاءات (استدعاء دالة بلا كائن يُحلّ إلى دالة الصنف نفسه، ودوال المكتبات الشائعة مثل toString لا تُربط بدالة في المشروع تحمل الاسم نفسه). دقّقها مراجع مستقل: نسخة أُعيدت تسمية كل ما فيها أعطت 98.3% نفسها، ونجحت 516 من 516 حالة تحويل. لكن Benchmark مجموعة اصطناعية، فلا تُقرأ النتيجة دقةً على الكود الحقيقي، وما زالت 38 حالة XSS في Java إنذارًا كاذبًا (FPR ‏18.2%). الجدول الكامل لكل فئة في القسم الإنجليزي أعلاه وفي صفحة الهبوط، وتعيد إنتاجه بأمر واحد:

git clone --depth 1 https://github.com/OWASP-Benchmark/BenchmarkJava && python bench/score_owasp.py BenchmarkJava

JavaScript وTypeScript: اختبارات CodeQL المُعلَّمة

لا توجد نسخة JavaScript من OWASP Benchmark، فنقيس JavaScript/TypeScript على اختبارات استعلامات الأمان في GitHub CodeQL (المجلد javascript/ql/test/query-tests/Security، الإيداع 12a0e51، برخصة MIT): برامج صغيرة بـ Express وKoa وNext.js وNode والمتصفح، يُعلِّم فريق CodeQL كل سطر فيها بأنه ثغرة (// $ Alert، ومنها MISSING: Alert التي يفوّتها CodeQL نفسه) أو آمن (تعليقات // OK … وSPURIOUS: Alert التي يبلّغ عنها CodeQL خطأً). تفحص أداة التقييم bench/score_js.py المجلد كاملًا كمشروع واحد بالملف الافتراضي، وتَعُدّ الحالة مكتشفة إذا وقعت على سطرها نتيجة من CWE فئتها. تشمل 21 استعلامًا من CodeQL يبلّغ Kashif عن CWE كلٍّ منها في JavaScript: 1,238 حالة ثغرة و267 حالة آمنة. على كل الحالات مجتمعة: ارتفع معدّل الإيجابيات الصحيحة من 48.6% إلى 59.1% وانخفض معدّل الإيجابيات الكاذبة من 23.2% إلى 20.2% بين 1.4 و1.5. ومتوسط (TPR − FPR) على الفئات الـ 21 بطريقة OWASP 23.2% كما في 1.4 (انظر الحدود أدناه). الجدول لكل فئة في القسم الإنجليزي أعلاه.

ما يقيسه وحدوده: هذه اختبارات وحدة كتبها فريق CodeQL لنماذجه، فهي تميل إلى ما يُنمذجه CodeQL (حزم npm كثيرة وأعراف الأطر وقواعد الموضع عنده)، وتصنيفها رأي CodeQL لا حقيقة مطلقة (سطر SPURIOUS: Alert الوحيد الآمن في فئة cmdi يقول إن الإبلاغ عنه «لا بأس به»، فنتيجة واحدة عليه تجعل FPR الفئة 100%). والحالات الآمنة قليلة (267) وموزعة بتفاوت (واحدة في cmdi و15 في xss-dom و4 في ssrf)، فيتحرك متوسط الفئات كثيرًا بنتيجة واحدة، والمعدّلات المجمّعة أثبت. وبعض الفئات تختبر ما لا يُنمذجه Kashif: رسائل الاستثناءات التي تحمل وسائطها (xss-exception)، وتدفّق البيانات الحساسة إلى تشفير أو تجزئة ضعيفة (crypto وhash: يبلّغ Kashif عن الخوارزمية الضعيفة حيث يُنشأ المُشفِّر، وCodeQL حيث تُكتب البيانات فيه)، والكوكيز التي تغيب عنها خاصية secure أو HttpOnly لا التي تُعطَّل صراحة، وأسماء ملفات الأرشيف كمصدر (zipslip)، والبيانات المقروءة من الملفات (xss-stored). والأسطر غير المُعلَّمة لا تُحسب (يؤكد CodeQL ألا تنبيه عليها لكن أغلبها ليس نقطة خطر)، وتطبع الأداة عدد النتائج الواقعة عليها (159). وهذه المجموعة ليست كودًا حقيقيًا: اقرأ الأرقام دليلًا على طريقة استدلال المحرّك في بنى JavaScript الشائعة، لا دقةً على الكود في مشروعك.

git clone --filter=blob:none --sparse https://github.com/github/codeql
git -C codeql sparse-checkout set javascript/ql/test/query-tests/Security
python bench/score_js.py codeql

### PHP: مجموعة NIST SARD لثغرات PHP

قسنا Kashif أيضًا على [PHP Vulnerability Test Suite](https://github.com/stivalet/PHP-Vulnerability-test-suite)
(مجموعة SARD رقم 103، الإيداع `6ebd7e0`) بتصنيفات ملفات manifest الخاصة بها، وبالطريقة نفسها (`bench/score_php.py`):
**PHP ‏45.4%** (كانت 6.0% قبل 1.5.0) على كل حالات فئات تدفق البيانات الثماني، أي 41,712 من 42,212 حالة (استُبعدت 480
حالة تخويل CWE-862 و20 حالة تشفير ورسائل خطأ). تقيس المجموعة قواعد كل دالة تعقيم وكل سياق إخراج HTML في سكربتات مولَّدة
صغيرة، لا تحليل تطبيق كامل؛ وكثير من تصنيفاتها يخالف سلوك PHP الفعلي (مثل `addslashes` أو `escapeshellarg` داخل
وسيط shell بين علامتي اقتباس مفردتين، و`htmlspecialchars` داخل معالج `onclick`)، وKashif يتبع سلوك PHP. لا يُعدّ
`$_SESSION` مدخلًا من المستخدم، ومخرجات أوامر shell مصدر محلي لا يُبلَّغ عنه في XSS وإعادة التوجيه. الجدول لكل فئة في
القسم الإنجليزي أعلاه، ويعيد إنتاج النتيجة أمر واحد:

```bash
git clone --depth 1 https://github.com/stivalet/PHP-Vulnerability-test-suite && python bench/score_php.py PHP-Vulnerability-test-suite

مقارنة مع الأدوات العالمية

كاشِف Semgrep SonarQube Snyk Code GitHub CodeQL Bandit Trivy
نوع التحليل أنماط + تدفق بيانات مدرك للأنواع عبر الملفات مع points-to حسّاس للسياق (k=2) وحسّاس للتدفق (12 لغة) + نماذج كبيانات + VQL بأصناف ومسندات ذاتية وتجميعات أنماط دلالية + تتبع بيانات (Pro) تحليل دلالي عميق تحليل دلالي + تعلّم آلي تحليل تدفق بيانات بلغة استعلام AST لـ Python إعدادات + اعتماديات + حاويات
اللغات 15+ أنماط · تدفق بيانات لـ 12 لغة 30+ 30+ 15+ 10+ Python فقط — (لا كود)
كشف الأسرار ✅ محدود ✅ (نسخ مدفوعة) ✅ ✅ ❌ ✅
ثغرات الاعتماديات (CVE) ✅ عبر OSV.dev ✅ (Supply Chain) محدود ✅ قوي ✅ Dependabot ❌ ✅ قوي
فحص أرشيف / APK / JAR ✅ + فك تجميع عبر jadx ❌ ❌ ❌ ❌ ❌ ✅ (صور وملفات)
فحص ويب سلبي (ترويسات/CSP/TLS/شهادة/مسارات مكشوفة) ✅ ❌ ❌ محدود (SaaS) ❌ ❌ ❌
واجهة رسومية محلية ✅ بلا خادم خارجي ❌ (SaaS) ✅ (تحتاج خادم وقاعدة بيانات) SaaS على GitHub ❌ ❌
التقرير مرتّب حسب الخطورة ✅ أساسًا ✅ ✅ ✅ ✅ ✅ ✅
مخرجات SARIF وخط أساس (الجديد فقط) ✅ ✅ ✅ ✅ ✅ ✅ (SARIF) ✅
مقارنة فحصين (ما أُصلح/ما استجد) ✅ في SaaS ✅ ✅ ✅ ❌ ❌
يعمل دون إنترنت ✅ (عدا OSV) ✅ محليًا ✅ ❌ ✅ CLI ✅ ✅ (بعد تنزيل DB)
الاعتماديات صفر (Python فقط) ثنائي + قواعد Java + DB حساب Snyk CodeQL CLI pip ثنائي Go
العربية ✅ عناوين وإصلاحات بالعربية ❌ ❌ ❌ ❌ ❌ ❌
السعر مجاني (MIT) مجاني/مدفوع Community/مدفوع مجاني محدود/مدفوع مجاني للمفتوح مجاني مجاني

أين يتفوق كاشِف؟ خفيف جدًا وبلا اعتماديات، يجمع تحليل تدفق البيانات في 12 لغة مع ملفات الإعداد والحاويات وCI والموبايل وOracle APEX في أداة واحدة، يقبل الأرشيفات وAPK مباشرة، واجهته وتقاريره بالعربية، ويقترح إصلاحات مُتحقَّقًا منها، ويدمج تلقائيًا نتائج Semgrep وBandit وgitleaks وnpm audit إن وُجدت فيصبح لوحة واحدة فوقها.

أين تتفوق الأدوات العالمية؟ CodeQL وSemgrep Pro وSonarQube وSnyk لديها آلاف القواعد ونماذج مكتبات أوسع بكثير، وسنوات من الضبط على قواعد كود ضخمة. إن كنت تستخدمها فأبقِها، وشغّل كاشِف بجانبها حيث يسدّ فجوة (العمل المحلي الكامل، وAPEX وPL/SQL، والأرشيفات، والعربية).

الاستخدام في بيئات الإنتاج

بدءًا من 1.0 يلتزم كاشِف بالترقيم الدلالي وبعقد ثبات مكتوب: خيارات سطر الأوامر ورموز الخروج، وصيغ تقارير JSON وSARIF وGitLab وCode Climate، وبصمات النتائج وملفات خط الأساس، ومعرّفات القواعد، وتعليقات الكتم، لا تنكسر داخل 1.x. وتُنشر صورة حاوية (linux/amd64 وlinux/arm64، بمستخدم غير جذري):

docker run --rm -v "$PWD:/src" ghcr.io/abdulrahmanahmedelabed-prog/kashif:1 .

عقد الثبات وسياسة الدعم وطرق النشر (CI، والشبكات المعزولة، ولوحة مركزية خلف وسيط عكسي يوثّق المستخدمين) في docs/production.md.

التطوير

pip install -e .[dev]
python -m pytest -q

البنية: scanner.py (المشي على الملفات والأرشيفات) · rules.py (القواعد) · deps.py (OSV) · web.py (الفحص السلبي) · external.py (الأدوات الخارجية) · report.py (التقارير) · server.py + ui/ (الواجهة) · store.py (الإعدادات والسجل) · cli.py.

حدود الأداة

  • الفحص الثابت بالقواعد يكشف الأنماط الشائعة ولا يغني عن مراجعة بشرية أو اختبار اختراق.
  • قد تظهر إنذارات كاذبة؛ استخدم --ignore-rule أو كتم السطر بعد التحقق.
  • غير منمذج بعد: القوالب غير Jinja (مثل EJS وERB)، والقيم التي تصل إلى ملف PHP عبر include، والقيم التي تمرّ عبر ملفات أو قواعد بيانات خارج الكود المفحوص. والمشاريع الكبيرة تحتاج ذاكرة: Django (نحو 7,000 ملف) تصل إلى نحو 3.5 GB.
  • النماذج أقل من الأدوات التجارية الكبرى (نحو 6,350 واجهة مكتبة و153 قاعدة نمطية)، والضبط على الكود الحقيقي أقل (ضُبط الإصدار 1.0 على 38 مشروعًا مفتوح المصدر).
  • بدون jadx تُفحص محتويات APK/JAR النصية فقط؛ ومع jadx يُفحص الكود المفكوك وهو كود مُعاد توليده قد يختلف عن المصدر الأصلي.
  • فحص الويب سلبي بالكامل (طلبات GET عادية فقط، ضمن حدّ معلَن لكل نمط فحص: minimal طلب واحد بتوجيهاته كما في 1.0) ولا يُجري أي اختبار نشط: يرى الصفحات العامة فقط، ولا يختبر الحقن ولا XSS ولا المصادقة ولا التحكم في الوصول ولا منطق العمل، ولا يتحقق من إلغاء الشهادة؛ ودرجته تقيس سلامة الإعدادات لا خلوّ الموقع من الثغرات.

حول كاشِف

كاشِف من تطوير دائرة البرمجة في الجامعة الإسلامية بغزة. للتواصل: its@iugaza.edu.ps وaelabed@iugaza.edu.ps

الرخصة

MIT

Metadata

Release files for kashif 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kashif 1.5.0
File Size Uploaded Provenance Actions
kashif-1.5.0.tar.gz 3.1 MB With provenance Details for kashif-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kashif 1.5.0
File Interpreter ABI Platform Actions
kashif-1.5.0-py3-none-any.whl Python 3 none any Details for kashif-1.5.0-py3-none-any.whl

Total release size: 5.8 MB

Release files / kashif-1.5.0.tar.gz

Download URL kashif-1.5.0.tar.gz
Size 3.1 MB
Tags Source
SHA-256 checksum
How to use checksums
f2f8a372925db1ae5336278214482f255a7749c861c047d163de1579bbad2554
BLAKE2b-256 checksum
How to use checksums
151b23f9140803a6a8325016b827d658ed71e54a6e559d90d6c12fa68338884f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / kashif-1.5.0-py3-none-any.whl

Download URL kashif-1.5.0-py3-none-any.whl
Size 2.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
16880b9c552db559525c750b7744c45b893ed179d3659abd77eedd831d45908f
BLAKE2b-256 checksum
How to use checksums
8cbead39f72208b96f6172e7debb024778a8425a5d2186ba37017618c8dcf6b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for kashif 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kashif-1.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page