Skip to main content

attackmap-analyzer-swift

Swift ecosystem analyzer plugin for AttackMap. Auto-discovered via the attackmap.analyzers entry point once installed.

License: MIT

Status: experimental. Vapor / Hummingbird routes with route-level auth, the iOS/macOS app attack surface, and a SwiftPM + CocoaPods + Carthage dependency SBOM. Requires an AttackMap core with the app-surface contract (mlaify/AttackMap#347).

Install

uv tool install attackmap --with attackmap-analyzer-swift \
  --index mlaify=https://pkg.mlaify.io/pypi/simple/ --index-strategy first-index
# or from source:
pip install git+https://github.com/mlaify/attackmap-analyzer-swift.git    # alongside attackmap

The analyzer is experimental and opt-in (enabled_by_default=False): installing it does not make it run on every scan. Select it explicitly:

attackmap analyze /path/to/swift/project -m swift

Files are walked with attackmap.sdk.iter_repo_files: .build/, DerivedData/, Pods/, Carthage/ and AttackMap's shared skip list (build/, .git/, node_modules/, ...) are pruned by their name inside the repo, and symlinks out of the repo are not followed.

What it does today

  • SwiftPM detection — recognizes Package.swift, .xcodeproj / .xcworkspace, and .swift sources; emits a SwiftPM framework hint.

  • Server-side routes (AttackMap#187) — Vapor 4 and Hummingbird 1.x/2.x route registrations (app.get("users", ":id"), on(.POST, ...), webSocket/ws, router.get("/x"), chained group.get(use:).post(use:)), with prefixes from grouped(...) / group(...) (closures, bindings and chains), and from where a RouteCollection or controller is mounted (register(collection:), addRoutes(to:), addRoutes(_:atPath:)) when every mount in the same Swift package agrees. Each route carries auth, guards and guard_evidence (AttackMap#256): required when Vapor's X.guardMiddleware() / X.redirectMiddleware(...), Hummingbird's IsAuthenticatedMiddleware or an *Authorization*Middleware applies, or the handler calls req.auth.require(...) / context.requireIdentity() or guards on the caller's identity with a 401. An authenticator alone (UserAuthenticator(), SessionAuthenticator) leaves the route unknown, since it only identifies callers who send credentials. Role checks in the handler (guard user.roles.contains(.admin)) are reported as guards. Paths the code computes (SiteURL.faq.pathComponents) are kept as $(SiteURL.faq), and an unknown mount as $(TypeName). Test targets (Tests/, *Tests/) are skipped.

  • iOS/macOS app attack surface (AttackMap#188) — reported as AppSurfaceIssues, which core turns into apple-* findings with CWE/OWASP ids.

    • Info.plist (XML or binary, read with plistlib, never executed): App Transport Security exceptions, i.e. NSAllowsArbitraryLoads (medium; low when a scoped key makes iOS 10+ ignore it), ...InWebContent / ...ForMedia, and per-domain NSExceptionAllowsInsecureHTTPLoads or a TLS minimum below 1.2 (low). Each custom CFBundleURLSchemes scheme is an entry point and an apple-custom-url-scheme finding (low); the handlers (application(_:open:options:), scene(_:openURLContexts:), .onOpenURL) are reported as entry points.
    • *.entitlements: cs.disable-library-validation, allow-dyld-environment-variables, allow-unsigned-executable-memory, disable-executable-page-protection (medium); get-task-allow outside a Debug/Dev entitlements file (low); applinks: universal-link domains as entry points.
    • *.xcconfig: secret-named build settings (API_KEY, CLIENT_SECRET, AUTH_TOKEN) with a literal value (not $(...), not a placeholder), reported as hard-coded secrets with the value masked.
    • Swift code:
      • evaluateJavaScript("...'\(value)'...") where a value is interpolated inside a JS string literal and isn't visibly encoded inline or where it was bound (sanitized, escaped, json, ...). Medium when the value is named like input, else low.
      • Secret-named values or keys written to UserDefaults (set(_:forKey:), @AppStorage("authToken")), or copied to UIPasteboard.general.
      • NSXPCListener services (entry points), and a shouldAcceptNewConnection that returns true without checking the peer: no audit token / PID / code-signing requirement, no validate/verify helper, and the connection isn't passed to any call. High when a NSXPCListener(machServiceName:) is registered in the same file or target (top-level directory); otherwise low, since a bundled XPC service or anonymous listener is reachable only by its parent app or an endpoint holder.
      • NSClassFromString / NSSelectorFromString / dlopen on a string built at the call site.
      • URL-scheme and universal-link handlers as entry points.
  • Dependency SBOM — parses Package.resolved (formats v1, v2, and v3, including the copy Xcode stashes under *.xcworkspace/xcshareddata/swiftpm/) into the scan's dependency inventory, marking direct vs. transitive by cross-referencing the Package.swift manifest. SwiftPM pins carry their repository URL, which --cve matches against OSV's SwiftURL ecosystem. CocoaPods Podfile.lock pods are inventoried (cocoapods; direct when listed under DEPENDENCIES:, subspecs folded into their pod); OSV has no CocoaPods database, so they aren't CVE-matched. Carthage Cartfile.resolved pins are inventoried as carthage (direct when the Cartfile lists them, a leading v dropped from tag versions) with the repository URL, so --cve matches them against OSV's SwiftURL ecosystem like SwiftPM pins.

  • Framework hints — flags server-side frameworks (Vapor, Hummingbird, Kitura, Perfect) when declared in the manifest.

  • Entrypoints — main.swift and @main.

  • Objective-C / Objective-C++ (AttackMap#190) — a second analyzer in this package, objc (opt-in: -m objc), for .m/.mm files that look like Objective-C (not MATLAB). It runs the same project-file checks (Info.plist, entitlements, xcconfig, Cartfile.resolved) and, in code: URL-scheme / universal-link / XPC entry points, evaluateJavaScript: with a stringWithFormat: %@ inside a JS string literal, secret-named values or keys in NSUserDefaults or on the pasteboard, XPC listeners that return YES without checking the peer, NSClassFromString / NSSelectorFromString / dlopen on built strings, and the native weaknesses shared with the C/C++ plugins: a non-literal, non-localized format with no arguments ([NSString stringWithFormat:msg], NSLog(msg)) as format_string, and /bin/sh -c with a built command or system()/popen() on a non-literal as native_command_exec. NSFileManager/NSURL file sinks aren't reported (no Objective-C taint pass yet). When both analyzers run, core's merge drops the duplicate project-file signals.

Roadmap

  • Taint for Swift/Objective-C sources (URL-scheme parameters to WKWebView / file sinks).

Part of the Swift analyzer epic.

Development

pip install -e ".[dev]"
pytest -q

License

MIT. Copyright (c) 2026 Matthew Davis and AttackMap Contributors.

Metadata

Release files for attackmap-analyzer-swift 0.2.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 attackmap-analyzer-swift 0.2.0
File Size Uploaded Provenance Actions
attackmap_analyzer_swift-0.2.0.tar.gz 61.0 kB With provenance Details for attackmap_analyzer_swift-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for attackmap-analyzer-swift 0.2.0
File Interpreter ABI Platform Actions
attackmap_analyzer_swift-0.2.0-py3-none-any.whl Python 3 none any Details for attackmap_analyzer_swift-0.2.0-py3-none-any.whl

Total release size: 107.4 kB

Release files / attackmap_analyzer_swift-0.2.0.tar.gz

Download URL attackmap_analyzer_swift-0.2.0.tar.gz
Size 61.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ed36ab9e6f920d25855702395c655c1f8c5d6e1ce8c8bb4d8de1ce950c204b48
BLAKE2b-256 checksum
How to use checksums
bf1927142b79918dfc1cc50c16dd33e3ec041f837945c5f415f7fa495c61d07d
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 14, 2026.

Transparency log

Release files / attackmap_analyzer_swift-0.2.0-py3-none-any.whl

Download URL attackmap_analyzer_swift-0.2.0-py3-none-any.whl
Size 46.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2a2b546a667e246cda1e376523098b43fe9ebb68516a79e09c528d3d235a0f9
BLAKE2b-256 checksum
How to use checksums
3bc8b6deb311c019d0b84daf5bb75707e71879f3b6e499971e3aeb62807674a8
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 14, 2026.

Transparency log

Security for attackmap-analyzer-swift 0.2.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 attackmap_analyzer_swift-0.2.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 14, 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

0.2.0 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