Skip to main content

Flutter Security Analyzer

CI License: MIT

A static analysis tool for detecting security vulnerabilities in Flutter/Dart applications with OWASP MASVS v2.1.0 compliance mapping.

Academic Project

This tool is developed as part of an MSc Cybersecurity final year project at the University of Chester.

Author: Caleb Elebhose
Supervisor: Dr. Bismark Asare
Module: WB7103/WB7104

Features

  • Pattern-Based Detection: Regex-based vulnerability detection for Dart code
  • MASVS Compliance Mapping: All findings mapped to OWASP MASVS v2.1.0 controls
  • Multiple Output Formats: Console, JSON, and HTML reports
  • CI/CD Integration: Exit codes suitable for pipeline integration
  • 26 Vulnerability Checks: Covering all 8 MASVS categories

Sample Report

HTML report from scanning samples/vulnerable_app.dart

The HTML report from scanning samples/vulnerable_app.dart, which contains deliberate vulnerabilities: 47 findings across all 8 MASVS categories.

MASVS Categories Covered

Category Description Checks
STORAGE Data storage security 4
CRYPTO Cryptographic implementations 3
AUTH Authentication and authorization 3
NETWORK Network communication security 3
PLATFORM Platform interaction security 4
CODE Code quality and injection prevention 4
RESILIENCE Anti-reverse engineering 3
PRIVACY User privacy protection 2

Most checks run line by line on .dart files. A few look at project configuration instead:

Check Files read
Missing certificate pinning, missing root/jailbreak detection pubspec.yaml (dependencies)
Vulnerable third-party dependencies pubspec.yaml
Outdated minimum SDK version android/app/build.gradle, android/app/build.gradle.kts, ios/Podfile
Missing code obfuscation CI workflows (.github/workflows/*.yml, .gitlab-ci.yml, codemagic.yaml, bitrise.yml), Makefile and shell scripts in the project root or scripts/

Only the check listed for a file is applied to it, and comment lines are ignored.

Installation

pip install flutter-security-analyzer

This adds the flutter-security-analyzer command. The scanner has no runtime dependencies beyond the Python standard library (Python 3.10 or later).

To work on the code, install it from a clone in editable mode:

git clone https://github.com/eCaleb/flutter-security-analyzer.git
cd flutter-security-analyzer
pip install -e ".[dev]"

Usage

Basic Scan

flutter-security-analyzer /path/to/flutter/project

# or run it as a module
python -m flutter_security_analyzer /path/to/flutter/project

Output Formats

# Console output (default)
flutter-security-analyzer ./my_flutter_app

# JSON output
flutter-security-analyzer ./my_flutter_app -f json -o results.json

# HTML report
flutter-security-analyzer ./my_flutter_app -f html -o report.html

Filter by Severity

# Only show high and critical findings
flutter-security-analyzer ./my_flutter_app -s high

Filter by MASVS Category

# Only scan for STORAGE and CRYPTO issues
flutter-security-analyzer ./my_flutter_app --masvs-category STORAGE CRYPTO

Verbose Mode

flutter-security-analyzer ./my_flutter_app -v

CI/CD Integration

Exit Codes

  • 0: No high or critical findings
  • 1: High severity findings detected
  • 2: Critical findings detected

GitHub Actions Example

- name: Security Scan
  run: |
    pip install flutter-security-analyzer
    flutter-security-analyzer ./lib -f json -o security-results.json

Docker

# Build the image (this also runs the unit tests)
docker build -t flutter-security-analyzer .

# Scan a project mounted at /scan
docker run -v $(pwd):/scan flutter-security-analyzer /scan

Known Limitations

  • Detection is pattern-based. The scanner matches regular expressions against the source rather than tracing how data flows between functions or files, so expect some false positives and some missed issues. A shared whitelist filters common false positives, such as security keywords in function and class names.
  • It scans .dart files plus the configuration files listed above. Apart from the build files used for the minimum SDK check, the android/ and ios/ folders are skipped, as are test folders, so it does not check AndroidManifest.xml, Info.plist, native code or compiled builds.
  • The dependency check only recognises a short list of known outdated versions written with a caret (for example http: ^0.13.0). It is not a full vulnerability database lookup, so use flutter pub outdated as well.
  • Findings are a starting point for review, not proof of a vulnerability. Check each one in context before acting on it.

Project Structure

flutter-security-analyzer/
├── src/flutter_security_analyzer/
│   ├── main.py              # CLI entry point
│   ├── __main__.py          # python -m flutter_security_analyzer
│   ├── core/
│   │   ├── scanner.py       # Main scanner logic
│   │   └── config.py        # Configuration handling
│   ├── patterns/
│   │   ├── base_pattern.py  # Pattern base class
│   │   ├── pattern_registry.py
│   │   ├── storage_patterns.py
│   │   ├── crypto_patterns.py
│   │   ├── auth_patterns.py
│   │   ├── network_patterns.py
│   │   ├── platform_patterns.py
│   │   ├── code_patterns.py
│   │   ├── resilience_patterns.py
│   │   └── privacy_patterns.py
│   ├── mappers/
│   │   └── masvs_mapper.py  # MASVS compliance mapping
│   └── reporters/
│       ├── console_reporter.py
│       ├── json_reporter.py
│       └── html_reporter.py
├── tests/
├── docs/images/             # README screenshots
├── samples/                 # Deliberately vulnerable and secure sample apps
├── .github/workflows/
├── Dockerfile
├── pyproject.toml
├── requirements.txt
└── README.md

Testing

# Run all tests
pytest

# With coverage
pytest --cov=src tests/

License

MIT License - See LICENSE file for details.

Acknowledgements

  • OWASP Mobile Application Security Project
  • University of Chester Cybersecurity Department

References

Metadata

Release files for flutter-security-analyzer 1.0.1

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

Source distribution (sdist)

Source distribution for flutter-security-analyzer 1.0.1
File Size Uploaded Provenance Actions
flutter_security_analyzer-1.0.1.tar.gz 58.1 kB With provenance Details for flutter_security_analyzer-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flutter-security-analyzer 1.0.1
File Interpreter ABI Platform Actions
flutter_security_analyzer-1.0.1-py3-none-any.whl Python 3 none any Details for flutter_security_analyzer-1.0.1-py3-none-any.whl

Total release size: 107.9 kB

Release files / flutter_security_analyzer-1.0.1.tar.gz

Download URL flutter_security_analyzer-1.0.1.tar.gz
Size 58.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9d524708c4edc84f0e5f8590556d010cd7ff4ff5c604e6ec7476f8f98947cf37
BLAKE2b-256 checksum
How to use checksums
db07c5a78f1afa6b8723118df905223e482636cd0da3cc139daa1b7e3c0e1c0b
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 16, 2026.

Transparency log

Release files / flutter_security_analyzer-1.0.1-py3-none-any.whl

Download URL flutter_security_analyzer-1.0.1-py3-none-any.whl
Size 49.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3a4848e39ab004bc7e83b49d5e3079c009b8deb58c021c1d8f443fc71a142b3
BLAKE2b-256 checksum
How to use checksums
fc3bc2ff59a597c63343d196b9c3ca2733041764b50a02b8fb366c5a39b31a5d
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 16, 2026.

Transparency log

Security for flutter-security-analyzer 1.0.1

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 flutter_security_analyzer-1.0.1.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 16, 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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full provenance

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