hardax 6.2.0__tar.gz → 6.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hardax-6.2.0 → hardax-6.2.2}/PKG-INFO +8 -8
- {hardax-6.2.0 → hardax-6.2.2}/README.md +7 -7
- {hardax-6.2.0 → hardax-6.2.2}/hardax/__init__.py +86 -5
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/adb_security.json +10 -10
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/apps.json +10 -7
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/attestation.json +2 -2
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/automotive.json +1 -1
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/binary_hardening.json +2 -2
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/biometric.json +2 -1
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/bluetooth.json +190 -32
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/boot_security.json +1 -1
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/cis_benchmark.json +2 -2
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/cryptography.json +2 -2
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/cve_indicators.json +23 -23
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/device_management.json +1 -1
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/forensic_indicators.json +14 -14
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/mdm_policy.json +1 -1
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/medical.json +1 -1
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/modern_android.json +14 -7
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/network.json +8 -5
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/partition.json +37 -26
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/pos_security.json +2 -2
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/selinux.json +7 -7
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/storage.json +11 -10
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/system.json +14 -14
- {hardax-6.2.0 → hardax-6.2.2}/hardax/templates/report.html +9 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax.egg-info/PKG-INFO +8 -8
- {hardax-6.2.0 → hardax-6.2.2}/hardax.egg-info/SOURCES.txt +2 -0
- {hardax-6.2.0 → hardax-6.2.2}/pyproject.toml +1 -1
- {hardax-6.2.0 → hardax-6.2.2}/tests/test_command_hygiene.py +122 -0
- hardax-6.2.2/tests/test_denied_device.py +165 -0
- hardax-6.2.2/tests/test_evidence_and_capability.py +542 -0
- hardax-6.2.2/tests/test_report_evidence.py +127 -0
- {hardax-6.2.0 → hardax-6.2.2}/tests/test_schema.py +17 -0
- hardax-6.2.0/tests/test_evidence_and_capability.py +0 -244
- {hardax-6.2.0 → hardax-6.2.2}/LICENSE +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/__main__.py +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/ai.py +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/analysis.py +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/certificate_audit.json +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/input.json +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/kernel_drivers.json +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/malware.json +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/nfc_security.json +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/privacy.json +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands/usb_security.json +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax/commands.schema.json +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax.egg-info/dependency_links.txt +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax.egg-info/entry_points.txt +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax.egg-info/requires.txt +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/hardax.egg-info/top_level.txt +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/setup.cfg +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/tests/test_ai.py +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/tests/test_analysis.py +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/tests/test_cli_display.py +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/tests/test_engine.py +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/tests/test_helpers.py +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/tests/test_regression_fixtures.py +0 -0
- {hardax-6.2.0 → hardax-6.2.2}/tests/test_reports.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hardax
|
|
3
|
-
Version: 6.2.
|
|
3
|
+
Version: 6.2.2
|
|
4
4
|
Summary: Hardening Audit eXaminer: security configuration auditor for Android-based devices (POS, IoT, automotive, medical, kiosk)
|
|
5
5
|
Author-email: "V33RU (Mr-IoT, IOTSRG)" <no-reply@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -78,7 +78,7 @@ Dynamic: license-file
|
|
|
78
78
|
<a href="https://pypi.org/project/hardax/">
|
|
79
79
|
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue.svg" alt="Python 3.10 | 3.11 | 3.12">
|
|
80
80
|
</a>
|
|
81
|
-
<img src="https://img.shields.io/badge/checks-
|
|
81
|
+
<img src="https://img.shields.io/badge/checks-841-orange.svg" alt="Checks">
|
|
82
82
|
<img src="https://img.shields.io/badge/categories-29-purple.svg" alt="Categories">
|
|
83
83
|
<a href="https://github.com/V33RU/hardax/blob/main/LICENSE">
|
|
84
84
|
<img src="https://img.shields.io/badge/license-MIT-red.svg" alt="License">
|
|
@@ -104,7 +104,7 @@ Dynamic: license-file
|
|
|
104
104
|
|
|
105
105
|
## Overview
|
|
106
106
|
|
|
107
|
-
**HARDAX** (Hardening Audit eXaminer) is a comprehensive security configuration auditor for Android-based devices. It performs **
|
|
107
|
+
**HARDAX** (Hardening Audit eXaminer) is a comprehensive security configuration auditor for Android-based devices. It performs **841 security checks** across **29 categories** to identify misconfigurations, vulnerabilities, and security weaknesses.
|
|
108
108
|
|
|
109
109
|
HARDAX is designed for:
|
|
110
110
|
- **Security Researchers** - Penetration testing and vulnerability assessment
|
|
@@ -119,7 +119,7 @@ HARDAX is designed for:
|
|
|
119
119
|
|
|
120
120
|
| Feature | Description |
|
|
121
121
|
|---------|-------------|
|
|
122
|
-
| **
|
|
122
|
+
| **841 Security Checks** | Comprehensive coverage across 29 security categories |
|
|
123
123
|
| **Deterministic Analysis Engine** | Offline risk score (0-100), attack-chain correlation, prioritised remediation - reasons only over confirmed findings, no LLM, no network, no hallucination |
|
|
124
124
|
| **Optional AI Narrative** | Opt-in `--ai` LLM summary on top of the deterministic engine (local Ollama, or Anthropic/OpenAI with your own key). Sends only the redacted analysis summary, never raw device output. Off by default |
|
|
125
125
|
| **POS/Payment Terminal Support** | 24 PCI-DSS focused checks for payment devices |
|
|
@@ -389,7 +389,7 @@ Hidden debug flags (prefix before other args):
|
|
|
389
389
|
|
|
390
390
|
## Security Categories
|
|
391
391
|
|
|
392
|
-
HARDAX organizes **
|
|
392
|
+
HARDAX organizes **841 checks** into **29 security categories**:
|
|
393
393
|
|
|
394
394
|
| Category | Checks | Description |
|
|
395
395
|
|----------|--------|-------------|
|
|
@@ -505,7 +505,7 @@ HARDAX/
|
|
|
505
505
|
├── ai.py # Optional opt-in LLM narrative (Ollama/Anthropic/OpenAI, stdlib only)
|
|
506
506
|
├── templates/
|
|
507
507
|
│ └── report.html # Interactive HTML report template
|
|
508
|
-
└── commands/ # Security check definitions (
|
|
508
|
+
└── commands/ # Security check definitions (841 checks, 29 categories)
|
|
509
509
|
├── system.json # 86 checks - Kernel, TEE (QSEE/Mobicore/TEEGRIS/Trusty), SECCOMP, build, emulator, WebView
|
|
510
510
|
├── bluetooth.json # 82 checks - BLE/Classic, pairing, all profiles
|
|
511
511
|
├── network.json # 61 checks - Ports, WiFi, VPN, IoT protocols, Allow 2G, hotspot WPA
|
|
@@ -592,7 +592,7 @@ Grouped by theme. Order within a group is rough priority.
|
|
|
592
592
|
|
|
593
593
|
#### Check metadata completeness
|
|
594
594
|
- [ ] Stable `id` on every check. Only 38% carry one, so reports are keyed on labels and a rename breaks downstream consumers
|
|
595
|
-
- [ ] `baseline_key` on the boot and identity checks. Only 7 of
|
|
595
|
+
- [ ] `baseline_key` on the boot and identity checks. Only 7 of 841 carry one, so `--save-baseline` watches almost nothing
|
|
596
596
|
- [ ] `why` and `risk_if_fail` beyond the current 8%. The XLSX and HTML reports fall back to `description` for the rest
|
|
597
597
|
- [ ] `expected_secure_state` beyond the current 2%, which is the field a Test ID / Component / Expected State methodology format needs
|
|
598
598
|
- [ ] Collapse the seven severity levels. `low`, `medium` and `high` are historical and map onto the same three buckets as `info`, `warning` and `critical`
|
|
@@ -613,7 +613,7 @@ Grouped by theme. Order within a group is rough priority.
|
|
|
613
613
|
#### Compliance mappings
|
|
614
614
|
- [ ] CIS Android Benchmark v1.6.0: fill the remaining 11% to 100% coverage. The current claim is not independently verified
|
|
615
615
|
- [ ] OWASP MASVS / MSTG mapping per check
|
|
616
|
-
- [ ] NIST 800-53 / 800-171 mapping per check (31 of
|
|
616
|
+
- [ ] NIST 800-53 / 800-171 mapping per check (31 of 841 checks carry one today)
|
|
617
617
|
- [ ] PCI-DSS 4.0 detailed mapping (POS terminals)
|
|
618
618
|
|
|
619
619
|
#### Tooling and ergonomics
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<a href="https://pypi.org/project/hardax/">
|
|
9
9
|
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue.svg" alt="Python 3.10 | 3.11 | 3.12">
|
|
10
10
|
</a>
|
|
11
|
-
<img src="https://img.shields.io/badge/checks-
|
|
11
|
+
<img src="https://img.shields.io/badge/checks-841-orange.svg" alt="Checks">
|
|
12
12
|
<img src="https://img.shields.io/badge/categories-29-purple.svg" alt="Categories">
|
|
13
13
|
<a href="https://github.com/V33RU/hardax/blob/main/LICENSE">
|
|
14
14
|
<img src="https://img.shields.io/badge/license-MIT-red.svg" alt="License">
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
## Overview
|
|
36
36
|
|
|
37
|
-
**HARDAX** (Hardening Audit eXaminer) is a comprehensive security configuration auditor for Android-based devices. It performs **
|
|
37
|
+
**HARDAX** (Hardening Audit eXaminer) is a comprehensive security configuration auditor for Android-based devices. It performs **841 security checks** across **29 categories** to identify misconfigurations, vulnerabilities, and security weaknesses.
|
|
38
38
|
|
|
39
39
|
HARDAX is designed for:
|
|
40
40
|
- **Security Researchers** - Penetration testing and vulnerability assessment
|
|
@@ -49,7 +49,7 @@ HARDAX is designed for:
|
|
|
49
49
|
|
|
50
50
|
| Feature | Description |
|
|
51
51
|
|---------|-------------|
|
|
52
|
-
| **
|
|
52
|
+
| **841 Security Checks** | Comprehensive coverage across 29 security categories |
|
|
53
53
|
| **Deterministic Analysis Engine** | Offline risk score (0-100), attack-chain correlation, prioritised remediation - reasons only over confirmed findings, no LLM, no network, no hallucination |
|
|
54
54
|
| **Optional AI Narrative** | Opt-in `--ai` LLM summary on top of the deterministic engine (local Ollama, or Anthropic/OpenAI with your own key). Sends only the redacted analysis summary, never raw device output. Off by default |
|
|
55
55
|
| **POS/Payment Terminal Support** | 24 PCI-DSS focused checks for payment devices |
|
|
@@ -319,7 +319,7 @@ Hidden debug flags (prefix before other args):
|
|
|
319
319
|
|
|
320
320
|
## Security Categories
|
|
321
321
|
|
|
322
|
-
HARDAX organizes **
|
|
322
|
+
HARDAX organizes **841 checks** into **29 security categories**:
|
|
323
323
|
|
|
324
324
|
| Category | Checks | Description |
|
|
325
325
|
|----------|--------|-------------|
|
|
@@ -435,7 +435,7 @@ HARDAX/
|
|
|
435
435
|
├── ai.py # Optional opt-in LLM narrative (Ollama/Anthropic/OpenAI, stdlib only)
|
|
436
436
|
├── templates/
|
|
437
437
|
│ └── report.html # Interactive HTML report template
|
|
438
|
-
└── commands/ # Security check definitions (
|
|
438
|
+
└── commands/ # Security check definitions (841 checks, 29 categories)
|
|
439
439
|
├── system.json # 86 checks - Kernel, TEE (QSEE/Mobicore/TEEGRIS/Trusty), SECCOMP, build, emulator, WebView
|
|
440
440
|
├── bluetooth.json # 82 checks - BLE/Classic, pairing, all profiles
|
|
441
441
|
├── network.json # 61 checks - Ports, WiFi, VPN, IoT protocols, Allow 2G, hotspot WPA
|
|
@@ -522,7 +522,7 @@ Grouped by theme. Order within a group is rough priority.
|
|
|
522
522
|
|
|
523
523
|
#### Check metadata completeness
|
|
524
524
|
- [ ] Stable `id` on every check. Only 38% carry one, so reports are keyed on labels and a rename breaks downstream consumers
|
|
525
|
-
- [ ] `baseline_key` on the boot and identity checks. Only 7 of
|
|
525
|
+
- [ ] `baseline_key` on the boot and identity checks. Only 7 of 841 carry one, so `--save-baseline` watches almost nothing
|
|
526
526
|
- [ ] `why` and `risk_if_fail` beyond the current 8%. The XLSX and HTML reports fall back to `description` for the rest
|
|
527
527
|
- [ ] `expected_secure_state` beyond the current 2%, which is the field a Test ID / Component / Expected State methodology format needs
|
|
528
528
|
- [ ] Collapse the seven severity levels. `low`, `medium` and `high` are historical and map onto the same three buckets as `info`, `warning` and `critical`
|
|
@@ -543,7 +543,7 @@ Grouped by theme. Order within a group is rough priority.
|
|
|
543
543
|
#### Compliance mappings
|
|
544
544
|
- [ ] CIS Android Benchmark v1.6.0: fill the remaining 11% to 100% coverage. The current claim is not independently verified
|
|
545
545
|
- [ ] OWASP MASVS / MSTG mapping per check
|
|
546
|
-
- [ ] NIST 800-53 / 800-171 mapping per check (31 of
|
|
546
|
+
- [ ] NIST 800-53 / 800-171 mapping per check (31 of 841 checks carry one today)
|
|
547
547
|
- [ ] PCI-DSS 4.0 detailed mapping (POS terminals)
|
|
548
548
|
|
|
549
549
|
#### Tooling and ergonomics
|
|
@@ -59,7 +59,7 @@ for _stream in (sys.stdout, sys.stderr):
|
|
|
59
59
|
# VERSION & CONSTANTS
|
|
60
60
|
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
61
61
|
|
|
62
|
-
__version__ = "6.2.
|
|
62
|
+
__version__ = "6.2.2"
|
|
63
63
|
|
|
64
64
|
REQUIRED_CHECK_KEYS = {"category", "label", "command", "safe_pattern", "level", "description"}
|
|
65
65
|
|
|
@@ -1302,6 +1302,14 @@ def commandNeedsBinder(command: str) -> bool:
|
|
|
1302
1302
|
return bool(_BINDER_TOOLS.search(command or ""))
|
|
1303
1303
|
|
|
1304
1304
|
|
|
1305
|
+
# A safe_pattern that matches any output at all is not a pass/fail rule, it is an
|
|
1306
|
+
# evidence collector. Reporting those as SAFE inflated the pass count: on the
|
|
1307
|
+
# reference panel 122 of 371 SAFE results came from checks that evaluated
|
|
1308
|
+
# nothing. They still run and still show their output, they are just reported as
|
|
1309
|
+
# INFO so the SAFE total means "tested against a rule and passed".
|
|
1310
|
+
ALWAYS_MATCH_PATTERNS = frozenset({".", ".*", "^.*$", "(?s).*", ".+", "^.+$"})
|
|
1311
|
+
|
|
1312
|
+
|
|
1305
1313
|
def probeCapabilities(device: Device) -> Dict[str, Any]:
|
|
1306
1314
|
"""Establish what this transport can actually reach before scoring anything.
|
|
1307
1315
|
|
|
@@ -1965,8 +1973,12 @@ def runChecks(device: Device, checks: List[Dict[str, Any]],
|
|
|
1965
1973
|
counts["verify"] += 1
|
|
1966
1974
|
needsVerification = True
|
|
1967
1975
|
elif matched:
|
|
1968
|
-
status = "
|
|
1969
|
-
|
|
1976
|
+
status = ("INFO" if safePattern in ALWAYS_MATCH_PATTERNS
|
|
1977
|
+
else "SAFE")
|
|
1978
|
+
# Derive the counter from the status just assigned. Writing the
|
|
1979
|
+
# two independently is what let counts["safe"] keep counting
|
|
1980
|
+
# rows that were reported INFO.
|
|
1981
|
+
counts[status.lower()] += 1
|
|
1970
1982
|
elif outputEmpty:
|
|
1971
1983
|
if emptyIsSafe:
|
|
1972
1984
|
status = "SAFE"
|
|
@@ -2430,6 +2442,38 @@ def auditCertificates(device: Device) -> List[Dict[str, Any]]:
|
|
|
2430
2442
|
# REPORT GENERATION - TXT
|
|
2431
2443
|
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
2432
2444
|
|
|
2445
|
+
_EVIDENCE_REPORT_MAX = 1200
|
|
2446
|
+
|
|
2447
|
+
|
|
2448
|
+
def evidenceLines(row):
|
|
2449
|
+
"""Render a row's evidence record as report lines.
|
|
2450
|
+
|
|
2451
|
+
A status on its own is not auditable: the reader cannot tell a CRITICAL
|
|
2452
|
+
read off a command's output from one produced by a command that never ran.
|
|
2453
|
+
The engine already records which observation decided the verdict and what
|
|
2454
|
+
the device actually returned; these lines put that in front of the reader.
|
|
2455
|
+
Returns [] for a row written before evidence records existed.
|
|
2456
|
+
"""
|
|
2457
|
+
ev = (row or {}).get("evidence") or {}
|
|
2458
|
+
if not ev:
|
|
2459
|
+
return []
|
|
2460
|
+
out = []
|
|
2461
|
+
if ev.get("basis"):
|
|
2462
|
+
out.append(("Basis", ev["basis"]))
|
|
2463
|
+
stdout = (ev.get("stdout") or "").strip()
|
|
2464
|
+
stderr = (ev.get("stderr") or "").strip()
|
|
2465
|
+
if stdout:
|
|
2466
|
+
out.append(("Device stdout", stdout[:_EVIDENCE_REPORT_MAX]))
|
|
2467
|
+
if stderr:
|
|
2468
|
+
out.append(("Device stderr", stderr[:_EVIDENCE_REPORT_MAX]))
|
|
2469
|
+
if not stdout and not stderr:
|
|
2470
|
+
out.append(("Device output", "(none)"))
|
|
2471
|
+
code = ev.get("exit_code")
|
|
2472
|
+
if code is not None:
|
|
2473
|
+
out.append(("Exit code", str(code)))
|
|
2474
|
+
return out
|
|
2475
|
+
|
|
2476
|
+
|
|
2433
2477
|
def writeTxtReport(path: str, deviceInfo: Dict[str, str],
|
|
2434
2478
|
rows: List[Dict[str, Any]], counts: Dict[str, int],
|
|
2435
2479
|
certs: List[Dict[str, Any]], deviceIdStr: str,
|
|
@@ -2462,6 +2506,13 @@ def writeTxtReport(path: str, deviceInfo: Dict[str, str],
|
|
|
2462
2506
|
f.write(f"Description: {r['description']}\n")
|
|
2463
2507
|
f.write(f"Result: {r['result'][:500]}{'...' if len(r['result']) > 500 else ''}\n")
|
|
2464
2508
|
f.write(f"Status: {r['status']}\n")
|
|
2509
|
+
for name, value in evidenceLines(r):
|
|
2510
|
+
if "\n" in value:
|
|
2511
|
+
f.write(f"{name}:\n")
|
|
2512
|
+
for line in value.split("\n"):
|
|
2513
|
+
f.write(f" {line}\n")
|
|
2514
|
+
else:
|
|
2515
|
+
f.write(f"{name}: {value}\n")
|
|
2465
2516
|
if r.get("remediation") and r["status"] not in ("SAFE", "INFO"):
|
|
2466
2517
|
f.write(f"Remediation: {r['remediation']}\n")
|
|
2467
2518
|
f.write("-" * 40 + "\n")
|
|
@@ -2635,10 +2686,15 @@ def writeXlsxReport(path: str, deviceInfo: Dict[str, str],
|
|
|
2635
2686
|
wf = wb.create_sheet("Findings")
|
|
2636
2687
|
cols = [("Category", 16), ("ID", 16), ("Label", 34), ("Status", 11), ("Level", 9),
|
|
2637
2688
|
("Why it matters", 42), ("Risk if failed", 42), ("Expected secure state", 30),
|
|
2638
|
-
("Command", 46), ("Output", 40),
|
|
2689
|
+
("Command", 46), ("Output", 40),
|
|
2690
|
+
# Evidence: what decided the verdict, and what the device actually
|
|
2691
|
+
# returned. Without these a Status column is an unsupported claim.
|
|
2692
|
+
("Basis", 46), ("Device stdout", 44), ("Device stderr", 34), ("Exit code", 9),
|
|
2693
|
+
("Description", 46), ("Remediation", 46),
|
|
2639
2694
|
("NIST 800-53", 16), ("CIS", 9), ("Tags", 20), ("Baseline", 12)]
|
|
2640
2695
|
_hdr(wf, 1, [c[0] for c in cols], [c[1] for c in cols])
|
|
2641
2696
|
for ri, row in enumerate(rows, start=2):
|
|
2697
|
+
_ev = row.get("evidence") or {}
|
|
2642
2698
|
tags = row.get("tags") or []
|
|
2643
2699
|
if isinstance(tags, list):
|
|
2644
2700
|
tags = ", ".join(str(t) for t in tags)
|
|
@@ -2646,6 +2702,9 @@ def writeXlsxReport(path: str, deviceInfo: Dict[str, str],
|
|
|
2646
2702
|
row.get("status", ""), row.get("level", ""), row.get("why", ""),
|
|
2647
2703
|
row.get("risk_if_fail", ""), row.get("expected_secure_state", ""),
|
|
2648
2704
|
row.get("command", ""), (str(row.get("result", "")) or "")[:2000],
|
|
2705
|
+
_ev.get("basis", ""), (_ev.get("stdout") or "")[:2000],
|
|
2706
|
+
(_ev.get("stderr") or "")[:2000],
|
|
2707
|
+
"" if _ev.get("exit_code") is None else str(_ev.get("exit_code")),
|
|
2649
2708
|
row.get("description", ""), row.get("remediation", ""),
|
|
2650
2709
|
row.get("nist_800_53", ""), row.get("cis_id", ""), tags, row.get("baseline", "")]
|
|
2651
2710
|
for ci, val in enumerate(vals, 1):
|
|
@@ -2895,6 +2954,28 @@ def writeHtmlReport(htmlPath: str, deviceInfo: Dict[str, str],
|
|
|
2895
2954
|
riskHtml = _detailGroup("Risk if failed", r.get("risk_if_fail", ""), "risk-group")
|
|
2896
2955
|
expHtml = _detailGroup("Expected secure state", r.get("expected_secure_state", ""))
|
|
2897
2956
|
|
|
2957
|
+
# Evidence. The Output block above shows the displayed result, which
|
|
2958
|
+
# can be a rewritten summary; these show the raw streams and the
|
|
2959
|
+
# observation the verdict was actually taken from.
|
|
2960
|
+
_ev = r.get("evidence") or {}
|
|
2961
|
+
evidenceHtml = _detailGroup("Basis", _ev.get("basis", ""), "basis-group")
|
|
2962
|
+
_stdout = (_ev.get("stdout") or "").strip()
|
|
2963
|
+
_stderr = (_ev.get("stderr") or "").strip()
|
|
2964
|
+
if _ev:
|
|
2965
|
+
evidenceHtml += (
|
|
2966
|
+
f'\n <div class="detail-group">'
|
|
2967
|
+
f'\n <span class="detail-tag">Device stdout'
|
|
2968
|
+
f' (exit {htmlEscape(str(_ev.get("exit_code", "?")))})</span>'
|
|
2969
|
+
f'\n <pre><code>'
|
|
2970
|
+
f'{htmlEscape(_stdout) if _stdout else "(none)"}</code></pre>'
|
|
2971
|
+
f'\n </div>')
|
|
2972
|
+
if _stderr:
|
|
2973
|
+
evidenceHtml += (
|
|
2974
|
+
f'\n <div class="detail-group">'
|
|
2975
|
+
f'\n <span class="detail-tag">Device stderr</span>'
|
|
2976
|
+
f'\n <pre><code>{htmlEscape(_stderr)}</code></pre>'
|
|
2977
|
+
f'\n </div>')
|
|
2978
|
+
|
|
2898
2979
|
remediationHtml = ""
|
|
2899
2980
|
remText = r.get("remediation", "")
|
|
2900
2981
|
if remText and st not in ("SAFE", "INFO"):
|
|
@@ -2936,7 +3017,7 @@ def writeHtmlReport(htmlPath: str, deviceInfo: Dict[str, str],
|
|
|
2936
3017
|
<div class="detail-group">
|
|
2937
3018
|
<span class="detail-tag">Output</span>
|
|
2938
3019
|
<pre><code>{resEsc if resEsc else "(empty)"}</code></pre>
|
|
2939
|
-
</div>{remediationHtml}{metaHtml}
|
|
3020
|
+
</div>{evidenceHtml}{remediationHtml}{metaHtml}
|
|
2940
3021
|
</div>
|
|
2941
3022
|
</div>''')
|
|
2942
3023
|
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
{
|
|
4
4
|
"category": "ADB_SECURITY",
|
|
5
5
|
"label": "ADB Keys Present",
|
|
6
|
-
"command": "
|
|
7
|
-
"safe_pattern": "
|
|
6
|
+
"command": "F=\"\"; D=\"\"; for p in /adb_keys /data/misc/adb/adb_keys /data/adb/adb_keys /data/misc/adb/adb_temp_keys.xml /vendor/etc/adb_keys /system/etc/adb_keys /product/etc/adb_keys /odm/etc/adb_keys /metadata/adb/adb_keys; do if ls -l \"$p\" >/dev/null 2>&1; then F=\"$F $p\"; elif ls -l \"$p\" 2>&1 | grep -qi \"permission denied\"; then D=\"$D $p\"; fi; done; if [ -n \"$F\" ]; then N=$(cat $F 2>/dev/null | grep -cE '^ssh-|^[A-Za-z0-9+/]{100,}'); echo \"authorized_key_files=[$F] keys=${N:-unreadable}\"; elif [ -n \"$D\" ]; then echo \"UNMEASURED key paths exist but are unreadable:$D\"; else echo \"no_adb_key_files\"; fi",
|
|
7
|
+
"safe_pattern": "^no_adb_key_files$",
|
|
8
8
|
"level": "warning",
|
|
9
|
-
"description": "
|
|
10
|
-
"remediation": "Remove
|
|
11
|
-
"empty_is_safe":
|
|
9
|
+
"description": "adbd accepts a host key from several locations, not one: /adb_keys baked into the image, /data/misc/adb/adb_keys written when a user taps Always allow, /data/misc/adb/adb_temp_keys.xml for time-limited grants on Android 9+, and vendor copies under /vendor, /system, /product or /odm. Any key present means some host can connect without the on-device prompt. A path that exists but cannot be read is reported as UNMEASURED, because SELinux denies stat as well as read and the old form suppressed stderr, turning a denied read into a clean result.",
|
|
10
|
+
"remediation": "Remove every adb_keys file and adb_temp_keys.xml from production images and from /data. Keep ro.adb.secure=1 so adbd always requires an interactive authorisation.",
|
|
11
|
+
"empty_is_safe": false
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"category": "ADB_SECURITY",
|
|
15
15
|
"label": "ADB Over Network Port",
|
|
16
|
-
"command": "getprop service.adb.tcp.port",
|
|
17
|
-
"safe_pattern": "
|
|
16
|
+
"command": "P=$(getprop service.adb.tcp.port 2>/dev/null); S=$(getprop ro.build.version.sdk 2>/dev/null); if [ -z \"$P\" ] && [ -z \"$S\" ]; then echo \"UNMEASURED getprop unavailable\"; elif [ -z \"$P\" ] || [ \"$P\" = \"0\" ] || [ \"$P\" = \"-1\" ]; then echo \"adb_tcp_port=disabled\"; else echo \"adb_tcp_port=$P\"; fi",
|
|
17
|
+
"safe_pattern": "^adb_tcp_port=disabled$",
|
|
18
18
|
"level": "warning",
|
|
19
|
-
"description": "service.adb.tcp.port
|
|
19
|
+
"description": "service.adb.tcp.port carries the TCP port adbd listens on. Unset, 0 or -1 all mean network ADB is off; any other value means adbd is reachable over the network, which removes the physical-access requirement from every ADB attack. The previous form treated the literal value 0 as a finding, flagging correctly hardened devices.",
|
|
20
20
|
"remediation": "Disable ADB over network by running 'adb shell setprop service.adb.tcp.port -1' and restarting ADB.",
|
|
21
|
-
"empty_is_safe":
|
|
21
|
+
"empty_is_safe": false
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
"category": "ADB_SECURITY",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"id": "ADB-BINARY-HASH-001",
|
|
79
79
|
"category": "ADB_SECURITY",
|
|
80
80
|
"label": "adbd Binary Integrity (SHA-256 Baseline)",
|
|
81
|
-
"command": "
|
|
81
|
+
"command": "H=$(sha256sum /system/bin/adbd 2>/dev/null | awk '{print $1}'); if [ -n \"$H\" ]; then printf '%s\\n' \"$H\"; elif ls /system/bin >/dev/null 2>&1; then echo MISSING; else echo \"UNMEASURED /system/bin not listable\"; fi",
|
|
82
82
|
"safe_pattern": "^[a-f0-9]{64}$",
|
|
83
83
|
"level": "info",
|
|
84
84
|
"description": "Records the SHA-256 of /system/bin/adbd so the operator can diff it against a known-good per-build baseline. dm-verity should already catch tampering on locked devices; this check exposes drift on devices where verity is disabled or the system partition is remounted rw. MISSING means adbd is absent or not executable.",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
{
|
|
120
120
|
"category": "APPS",
|
|
121
121
|
"label": "Running Services Count",
|
|
122
|
-
"command": "dumpsys activity services | grep -E 'package|process' | wc -l",
|
|
122
|
+
"command": "D=$(dumpsys activity services 2>/dev/null); case \"$D\" in \"\"|*\"Can't find service\"*|*\"Failure calling service\"*|*\"Failed transaction\"*|*\"does not exist\"*|*\"Found 0 services\"*) echo \"UNMEASURED dumpsys activity services did not answer\";; *) printf '%s\\n' \"$D\" | grep -E 'package|process' | wc -l;; esac",
|
|
123
123
|
"safe_pattern": ".*",
|
|
124
124
|
"level": "info",
|
|
125
125
|
"description": "Running services on device",
|
|
@@ -246,7 +246,8 @@
|
|
|
246
246
|
"safe_pattern": ".",
|
|
247
247
|
"level": "info",
|
|
248
248
|
"description": "Non-Android services/daemons running",
|
|
249
|
-
"remediation": "Audit each custom daemon for necessity and security. Disable unneeded ones via init scripts."
|
|
249
|
+
"remediation": "Audit each custom daemon for necessity and security. Disable unneeded ones via init scripts.",
|
|
250
|
+
"binder_optional": true
|
|
250
251
|
},
|
|
251
252
|
{
|
|
252
253
|
"category": "APPS",
|
|
@@ -457,7 +458,8 @@
|
|
|
457
458
|
"safe_pattern": ".",
|
|
458
459
|
"level": "info",
|
|
459
460
|
"description": "The SDK Runtime, part of Privacy Sandbox on Android, moves third-party advertising and analytics SDKs out of the host app process into a separate sandboxed process with its own restricted permissions and no access to the host app's storage or non-sandboxed permissions. This reports whether the SDK Runtime and AdServices packages are installed. It matters for audit scope: when the runtime is active, an SDK's data access is no longer implied by the host app's manifest permissions, so an app permission review alone no longer describes what a bundled SDK can reach. Informational, since the runtime's presence depends on the Android version and whether the build ships GMS.",
|
|
460
|
-
"remediation": "Nothing to fix on-device. When reviewing app permissions on a device with the SDK Runtime present, audit sandboxed SDK permissions separately from host app permissions rather than assuming the host manifest covers both."
|
|
461
|
+
"remediation": "Nothing to fix on-device. When reviewing app permissions on a device with the SDK Runtime present, audit sandboxed SDK permissions separately from host app permissions rather than assuming the host manifest covers both.",
|
|
462
|
+
"binder_optional": true
|
|
461
463
|
},
|
|
462
464
|
{
|
|
463
465
|
"id": "APP-HIDDENAPI-001",
|
|
@@ -512,7 +514,7 @@
|
|
|
512
514
|
"id": "APP-SIGV4-001",
|
|
513
515
|
"category": "APPS",
|
|
514
516
|
"label": "APK Signature Scheme Distribution",
|
|
515
|
-
"command": "
|
|
517
|
+
"command": "D=$(dumpsys package 2>/dev/null); I=$(find /data/app -maxdepth 4 -name '*.idsig' 2>/dev/null | wc -l); case \"$D\" in \"\"|*\"Can't find service\"*|*\"Failure calling service\"*|*\"Failed transaction\"*|*\"Found 0 services\"*) echo \"UNMEASURED dumpsys package did not answer; idsig_files=$I\";; *) V=$(printf '%s\\n' \"$D\" | grep -oE 'apkSigningVersion=[0-9]+' | sort | uniq -c | awk '{printf \"v%s=%s \", substr($2,18), $1}'); echo \"${V:-no_signing_info} idsig_files=$I\";; esac",
|
|
516
518
|
"safe_pattern": ".",
|
|
517
519
|
"level": "info",
|
|
518
520
|
"empty_is_safe": false,
|
|
@@ -523,7 +525,7 @@
|
|
|
523
525
|
"id": "APP-ROLLBACK-001",
|
|
524
526
|
"category": "APPS",
|
|
525
527
|
"label": "Package Rollback and Downgrade Protection",
|
|
526
|
-
"command": "
|
|
528
|
+
"command": "D=$(dumpsys rollback 2>/dev/null); case \"$D\" in \"\"|*\"Can't find service\"*|*\"Failure calling service\"*|*\"Failed transaction\"*|*\"Found 0 services\"*) echo \"UNMEASURED dumpsys rollback did not answer\";; *) A=$(printf '%s' \"$D\" | head -20 | grep -ci 'rollbackId'); echo \"rollback_service=present available_rollbacks=${A:-0}\";; esac",
|
|
527
529
|
"safe_pattern": ".",
|
|
528
530
|
"level": "info",
|
|
529
531
|
"empty_is_safe": false,
|
|
@@ -541,13 +543,14 @@
|
|
|
541
543
|
"description": "Counts split APK files and staged install sessions. A split APK is verified as part of its base package, but a session left staged is a pending install that will be applied at next reboot, and on a device being audited it means code is queued to run that is not yet reflected in the installed package list. A staged session is normal briefly during an OTA or a Play update, so a non-zero count on an idle device is worth explaining rather than assuming benign.",
|
|
542
544
|
"remediation": "Inspect any staged session with 'pm list staged-sessions' and abandon unexpected ones with 'pm install-abandon <id>'. Re-audit after the pending install has been applied.",
|
|
543
545
|
"why": "A staged session is code queued to install at next boot that no package listing yet reflects.",
|
|
544
|
-
"risk_if_fail": "The device will apply an install after reboot that the audit did not evaluate."
|
|
546
|
+
"risk_if_fail": "The device will apply an install after reboot that the audit did not evaluate.",
|
|
547
|
+
"binder_optional": true
|
|
545
548
|
},
|
|
546
549
|
{
|
|
547
550
|
"id": "APP-EXPORTED-001",
|
|
548
551
|
"category": "APPS",
|
|
549
552
|
"label": "Exported Components Without Permission (Third-Party)",
|
|
550
|
-
"command": "D=$(dumpsys package 2>/dev/null);
|
|
553
|
+
"command": "D=$(dumpsys package 2>/dev/null); case \"$D\" in \"\"|*\"Can't find service\"*|*\"Failure calling service\"*|*\"Failed transaction\"*|*\"Found 0 services\"*) echo \"UNMEASURED dumpsys package did not answer\";; *) E=$(printf '%s' \"$D\" | grep -c 'exported=true'); P=$(printf '%s' \"$D\" | grep -c 'permission='); echo \"exported_components=${E:-0} with_permission_declared=${P:-0}\";; esac",
|
|
551
554
|
"safe_pattern": ".",
|
|
552
555
|
"level": "verify",
|
|
553
556
|
"empty_is_safe": false,
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
"id": "ATT-021",
|
|
200
200
|
"category": "ATTESTATION",
|
|
201
201
|
"label": "Hardware-Backed Keystore / KeyMint HAL Present",
|
|
202
|
-
"command": "
|
|
202
|
+
"command": "PF=$(pm list features 2>/dev/null); H=$(getprop ro.hardware.keystore 2>/dev/null); L=$(lshal 2>/dev/null | grep -oiE 'keymint@[0-9.]+|keymaster@[0-9.]+' | sort -u | tr '\\n' ' '); case \"$PF\" in \"\"|*\"Can't find service\"*|*\"Failure calling service\"*|*\"Failed transaction\"*|*\"Found 0 services\"*) if [ -z \"$H$L\" ]; then echo \"UNMEASURED pm did not answer and no keystore prop or HAL entry\"; else echo \"features=unmeasured hal_prop=${H:-unset} hal=${L:-unavailable}\"; fi;; *) F=$(printf '%s\\n' \"$PF\" | grep -iE 'hardware_keystore|strongbox' | tr '\\n' ' '); echo \"features=${F:-none} hal_prop=${H:-unset} hal=${L:-unavailable}\";; esac",
|
|
203
203
|
"safe_pattern": "hardware_keystore|strongbox|keymint@|keymaster@",
|
|
204
204
|
"level": "warning",
|
|
205
205
|
"description": "Hardware key attestation is the root of every attestation claim this category makes. It requires a KeyMint (Android 12+) or Keymaster (older) HAL backing the keystore. The android.hardware.hardware_keystore feature is reported with a version suffix (for example =300 for KeyMint 3.0) and android.hardware.strongbox_keystore indicates a discrete secure element. If none of these are present, the device has no hardware-backed key storage: keys live in software, attestation certificates cannot be chained to a Google-signed root, and the other ATTESTATION checks describe policy rather than enforced hardware. The lshal probe is best-effort because non-root shells on some user builds cannot enumerate HALs, so 'hal=unavailable' alone is not a failure.",
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
"id": "ATT-022",
|
|
212
212
|
"category": "ATTESTATION",
|
|
213
213
|
"label": "Remote Key Provisioning (Attestation Key Certification)",
|
|
214
|
-
"command": "
|
|
214
|
+
"command": "PL=$(pm list packages 2>/dev/null); L=$(lshal 2>/dev/null | grep -oiE 'IRemotelyProvisionedComponent[^ ]*' | sort -u | head -3 | tr '\\n' ' '); case \"$PL\" in \"\"|*\"Can't find service\"*|*\"Failure calling service\"*|*\"Failed transaction\"*|*\"Found 0 services\"*) if [ -z \"$L\" ]; then echo \"UNMEASURED pm did not answer and no RKP HAL entry\"; else echo \"rkp_app=unmeasured rkp_hal=${L}\"; fi;; *) P=$(printf '%s\\n' \"$PL\" | grep -iE 'rkpdapp|remoteprovisioner' | sed 's/^package://' | tr '\\n' ' '); echo \"rkp_app=${P:-none} rkp_hal=${L:-unavailable}\";; esac",
|
|
215
215
|
"safe_pattern": ".",
|
|
216
216
|
"level": "info",
|
|
217
217
|
"description": "Remote Key Provisioning replaced factory-installed attestation key batches on Android 12 and later: the device generates keys locally and has them certified on demand by a Google backend, so a leaked factory key batch can be revoked without bricking attestation. Not to be confused with Samsung RKP (Real-time Kernel Protection), which is a separate check in this category. This reports whether the provisioning daemon app and the IRemotelyProvisionedComponent HAL are present. Informational rather than pass or fail: remote provisioning is part of the GMS ecosystem, so AOSP builds, non-GMS OEM builds, and many POS or industrial devices legitimately have neither, and their absence is a deployment fact to record rather than a misconfiguration.",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
{
|
|
32
32
|
"category": "AUTOMOTIVE",
|
|
33
33
|
"label": "Apps with VEHICLE Permissions",
|
|
34
|
-
"command": "for perm in CAR_INFO CAR_EXTERIOR_ENVIRONMENT CAR_SPEED CAR_MILEAGE; do echo \"==$perm==\";
|
|
34
|
+
"command": "D=$(dumpsys package 2>/dev/null); case \"$D\" in \"\"|*\"Can't find service\"*|*\"Failure calling service\"*|*\"Failed transaction\"*|*\"Found 0 services\"*) echo \"UNMEASURED dumpsys package did not answer\";; *) for perm in CAR_INFO CAR_EXTERIOR_ENVIRONMENT CAR_SPEED CAR_MILEAGE; do echo \"==$perm==\"; printf '%s\\n' \"$D\" | grep -B5 \"android.car.permission.$perm\" | grep 'Package \\[' | head -2; done;; esac",
|
|
35
35
|
"safe_pattern": ".",
|
|
36
36
|
"level": "info",
|
|
37
37
|
"description": "Apps with vehicle data access permissions",
|
|
@@ -349,8 +349,8 @@
|
|
|
349
349
|
"id": "BIN-034",
|
|
350
350
|
"category": "BINARY_HARDENING",
|
|
351
351
|
"label": "Kernel Modules Disabled",
|
|
352
|
-
"command": "cat /proc/sys/kernel/modules_disabled",
|
|
353
|
-
"safe_pattern": "^1$",
|
|
352
|
+
"command": "V=$(cat /proc/sys/kernel/modules_disabled 2>/dev/null); if [ -n \"$V\" ]; then printf '%s\\n' \"$V\"; elif ls /proc/sys/kernel >/dev/null 2>&1; then echo MODULES_SYSCTL_ABSENT; else echo \"UNMEASURED /proc/sys/kernel not listable\"; fi",
|
|
353
|
+
"safe_pattern": "^1$|^MODULES_SYSCTL_ABSENT$",
|
|
354
354
|
"level": "warning",
|
|
355
355
|
"description": "Disabling kernel module loading after boot prevents rootkits from loading malicious kernel modules.",
|
|
356
356
|
"remediation": "Lock module loading post-boot: echo 1 > /proc/sys/kernel/modules_disabled (irreversible until reboot)."
|
|
@@ -73,7 +73,8 @@
|
|
|
73
73
|
"empty_is_safe": false,
|
|
74
74
|
"requires_manual_review": true,
|
|
75
75
|
"description": "Reports lockout, failed-attempt and strong-auth state from lock_settings, plus the permissions on the Gatekeeper key blobs and the lock settings database. Gatekeeper enforces escalating delays after failed unlock attempts, and its counter must live in tamper-resistant storage (see ATT-026 on RPMB) or the throttling can be reset by rolling back the counter, turning a four-digit PIN into an offline brute force. Reported for review because the dump format is OEM-specific and a restricted or absent view is itself a good sign.",
|
|
76
|
-
"remediation": "Confirm the Gatekeeper failure counter is backed by RPMB or equivalent replay-protected storage rather than plain userdata, and that the key blobs are not readable outside the system UID."
|
|
76
|
+
"remediation": "Confirm the Gatekeeper failure counter is backed by RPMB or equivalent replay-protected storage rather than plain userdata, and that the key blobs are not readable outside the system UID.",
|
|
77
|
+
"binder_optional": true
|
|
77
78
|
}
|
|
78
79
|
]
|
|
79
80
|
}
|