exeradar 2026.9.1__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.
- exeradar-2026.9.1/.github/workflows/codeql.yml +40 -0
- exeradar-2026.9.1/.github/workflows/docker-build-check.yml +26 -0
- exeradar-2026.9.1/.github/workflows/publish.yml +39 -0
- exeradar-2026.9.1/.github/workflows/sonarcloud.yml +44 -0
- exeradar-2026.9.1/.github/workflows/tests.yml +50 -0
- exeradar-2026.9.1/.gitignore +13 -0
- exeradar-2026.9.1/ARCHITECTURE.md +298 -0
- exeradar-2026.9.1/ATTRIBUTIONS.md +77 -0
- exeradar-2026.9.1/CHANGELOG.md +108 -0
- exeradar-2026.9.1/Dockerfile +26 -0
- exeradar-2026.9.1/LICENSE +21 -0
- exeradar-2026.9.1/PKG-INFO +119 -0
- exeradar-2026.9.1/README.md +73 -0
- exeradar-2026.9.1/exeradar/__init__.py +1 -0
- exeradar-2026.9.1/exeradar/__main__.py +4 -0
- exeradar-2026.9.1/exeradar/cli.py +141 -0
- exeradar-2026.9.1/exeradar/formats/__init__.py +1 -0
- exeradar-2026.9.1/exeradar/formats/pe.py +176 -0
- exeradar-2026.9.1/exeradar/law_cache.py +105 -0
- exeradar-2026.9.1/exeradar/law_checker.py +371 -0
- exeradar-2026.9.1/exeradar/law_fetcher.py +672 -0
- exeradar-2026.9.1/exeradar/models.py +101 -0
- exeradar-2026.9.1/exeradar/report.py +302 -0
- exeradar-2026.9.1/exeradar/scanner.py +117 -0
- exeradar-2026.9.1/exeradar/signature.py +258 -0
- exeradar-2026.9.1/exeradar/strings.py +226 -0
- exeradar-2026.9.1/pyproject.toml +67 -0
- exeradar-2026.9.1/tests/__init__.py +0 -0
- exeradar-2026.9.1/tests/conftest.py +87 -0
- exeradar-2026.9.1/tests/docker/__init__.py +0 -0
- exeradar-2026.9.1/tests/docker/smoke.py +22 -0
- exeradar-2026.9.1/tests/fixtures/cra_it_excerpt.html +467 -0
- exeradar-2026.9.1/tests/fixtures/gdpr_it_excerpt.html +78 -0
- exeradar-2026.9.1/tests/fixtures/nis2_it_excerpt.html +169 -0
- exeradar-2026.9.1/tests/fixtures/python-LICENSE.txt +676 -0
- exeradar-2026.9.1/tests/fixtures/python.exe +0 -0
- exeradar-2026.9.1/tests/test_cli.py +257 -0
- exeradar-2026.9.1/tests/test_law_checker.py +426 -0
- exeradar-2026.9.1/tests/test_law_fetcher.py +205 -0
- exeradar-2026.9.1/tests/test_pe.py +141 -0
- exeradar-2026.9.1/tests/test_report.py +317 -0
- exeradar-2026.9.1/tests/test_scanner.py +174 -0
- exeradar-2026.9.1/tests/test_signature.py +162 -0
- exeradar-2026.9.1/tests/test_skeleton.py +71 -0
- exeradar-2026.9.1/tests/test_strings.py +250 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: CodeQL
|
|
2
|
+
on:
|
|
3
|
+
# Code scanning depends on repository settings as much as on the code, so
|
|
4
|
+
# being able to re-run it without an empty commit is worth two lines. The
|
|
5
|
+
# first run here failed because the repository was private and code scanning
|
|
6
|
+
# was unavailable; nothing in the code had changed when it started passing.
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
push:
|
|
9
|
+
branches: [ main ]
|
|
10
|
+
pull_request:
|
|
11
|
+
branches: [ main ]
|
|
12
|
+
schedule:
|
|
13
|
+
- cron: '30 1 * * 1'
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
security-events: write
|
|
17
|
+
# Private repositories only: the CodeQL action reads the workflow run through
|
|
18
|
+
# the API to attach the results, and without this it fails with "Resource not
|
|
19
|
+
# accessible by integration". Public repositories do not need it.
|
|
20
|
+
actions: read
|
|
21
|
+
jobs:
|
|
22
|
+
analyze:
|
|
23
|
+
# Named for the check context: the ruleset requires a name, and a job name
|
|
24
|
+
# that says what it is survives better than the workflow name.
|
|
25
|
+
name: CodeQL
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout
|
|
29
|
+
uses: actions/checkout@v7
|
|
30
|
+
- name: Initialize CodeQL
|
|
31
|
+
uses: github/codeql-action/init@v4
|
|
32
|
+
with:
|
|
33
|
+
languages: python
|
|
34
|
+
# Python needs no build. The autobuild step the other Radars inherited
|
|
35
|
+
# is superfluous here and is what failed on mailradar in September.
|
|
36
|
+
build-mode: none
|
|
37
|
+
- name: Perform CodeQL Analysis
|
|
38
|
+
uses: github/codeql-action/analyze@v4
|
|
39
|
+
with:
|
|
40
|
+
category: "/language:python"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Docker Build Check
|
|
2
|
+
# Builds the image from the repository source and runs the smoke test without
|
|
3
|
+
# pushing anything. The release workflow, when it exists, will publish to
|
|
4
|
+
# Docker Hub including :latest, so there has to be a way to try a Dockerfile
|
|
5
|
+
# change out that does not publish one.
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v7
|
|
16
|
+
- name: Set up Docker Buildx
|
|
17
|
+
uses: docker/setup-buildx-action@v4
|
|
18
|
+
- name: Build image from source
|
|
19
|
+
uses: docker/build-push-action@v7
|
|
20
|
+
with:
|
|
21
|
+
context: .
|
|
22
|
+
load: true
|
|
23
|
+
push: false
|
|
24
|
+
tags: exeradar:build-check
|
|
25
|
+
- name: Smoke test
|
|
26
|
+
run: docker run --rm -i --entrypoint python exeradar:build-check - < tests/docker/smoke.py
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-and-publish:
|
|
11
|
+
name: Build and publish to PyPI
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
environment:
|
|
14
|
+
name: pypi
|
|
15
|
+
url: https://pypi.org/p/exeradar
|
|
16
|
+
# Trusted publishing: the token is minted for this job by GitHub and
|
|
17
|
+
# exchanged with PyPI, so there is no API token in the repository.
|
|
18
|
+
permissions:
|
|
19
|
+
id-token: write
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout
|
|
23
|
+
uses: actions/checkout@v7
|
|
24
|
+
|
|
25
|
+
- name: Set up Python
|
|
26
|
+
uses: actions/setup-python@v7
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.13"
|
|
29
|
+
|
|
30
|
+
- name: Install build dependencies
|
|
31
|
+
run: pip install --upgrade build hatchling # NOSONAR - trusted packages
|
|
32
|
+
|
|
33
|
+
- name: Build package
|
|
34
|
+
run: python -m build
|
|
35
|
+
|
|
36
|
+
- name: Publish to PyPI
|
|
37
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
38
|
+
with:
|
|
39
|
+
verify-metadata: false
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: SonarCloud Analysis
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [ main ]
|
|
5
|
+
pull_request:
|
|
6
|
+
types: [opened, synchronize, reopened]
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
jobs:
|
|
10
|
+
sonarcloud:
|
|
11
|
+
name: SonarCloud
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
# GitHub passes no Actions secrets to Dependabot or fork PRs: there the
|
|
14
|
+
# token is empty and the scan fails with "Not authorized". A step's `if:`
|
|
15
|
+
# cannot read `secrets`, so the job publishes only whether it exists; the
|
|
16
|
+
# token itself stays with the scanner. Those runs still test and build
|
|
17
|
+
# coverage. This also keeps the workflow green before the Sonar project
|
|
18
|
+
# exists at all.
|
|
19
|
+
env:
|
|
20
|
+
SONAR_ENABLED: ${{ secrets.SONAR_TOKEN != '' }}
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v7
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
- name: Set up Python
|
|
26
|
+
uses: actions/setup-python@v7
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.12"
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install --group dev -e .
|
|
33
|
+
- name: Run tests with coverage
|
|
34
|
+
run: pytest tests/ --cov --cov-report=xml:coverage.xml
|
|
35
|
+
|
|
36
|
+
- name: SonarQube Scan
|
|
37
|
+
if: ${{ env.SONAR_ENABLED == 'true' }}
|
|
38
|
+
uses: SonarSource/sonarqube-scan-action@v8
|
|
39
|
+
env:
|
|
40
|
+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
41
|
+
|
|
42
|
+
- name: Report skipped scan
|
|
43
|
+
if: ${{ env.SONAR_ENABLED != 'true' }}
|
|
44
|
+
run: echo "::notice title=SonarCloud skipped::SONAR_TOKEN is not available to this run (Dependabot PR, fork PR, or the project is not set up yet)."
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [ main ]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [ main ]
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: test (${{ matrix.python-version }})
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
# Keep in sync with the classifiers in pyproject.toml
|
|
17
|
+
python-version: ["3.11", "3.12", "3.13", "3.14"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
21
|
+
uses: actions/setup-python@v7
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
# --group needs pip >= 25.1 to read PEP 735 [dependency-groups]
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install --group dev -e .
|
|
29
|
+
- name: Run test suite
|
|
30
|
+
run: pytest tests/ -v
|
|
31
|
+
|
|
32
|
+
summary:
|
|
33
|
+
# The branch ruleset requires one check name that survives matrix changes.
|
|
34
|
+
# The matrix job cannot provide it: its contexts carry the Python version,
|
|
35
|
+
# so they change whenever the matrix does. always(): a skipped required
|
|
36
|
+
# check counts as passed, so this has to run even when the matrix fails,
|
|
37
|
+
# and fail explicitly in that case.
|
|
38
|
+
name: Tests
|
|
39
|
+
needs: [test]
|
|
40
|
+
if: always()
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
steps:
|
|
43
|
+
- name: All test jobs succeeded
|
|
44
|
+
env:
|
|
45
|
+
RESULTS: ${{ join(needs.*.result, ' ') }}
|
|
46
|
+
run: |
|
|
47
|
+
echo "Results: $RESULTS"
|
|
48
|
+
for result in $RESULTS; do
|
|
49
|
+
[ "$result" = "success" ] || { echo "::error::A required test job ended with: $result"; exit 1; }
|
|
50
|
+
done
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# ExeRadar — architecture
|
|
2
|
+
|
|
3
|
+
Static analysis of executables: PE first, ELF and Mach-O after.
|
|
4
|
+
|
|
5
|
+
This is the design, written before the code. Where it makes a claim about a
|
|
6
|
+
library it is because the claim was measured, not remembered; the spike that
|
|
7
|
+
produced the measurements is in `Documents/Dev/exeradar-spike/spike_lief.py`.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Layout
|
|
12
|
+
|
|
13
|
+
Same shape as the other Radar projects, minus the files that are dead there.
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
exeradar/
|
|
17
|
+
__init__.py __version__ — hatchling reads the version from here
|
|
18
|
+
__main__.py
|
|
19
|
+
cli.py typer: analyze, batch, verify
|
|
20
|
+
scanner.py orchestrates: a path in, an ExeResult out
|
|
21
|
+
formats/
|
|
22
|
+
__init__.py dispatch on the magic number
|
|
23
|
+
pe.py headers, sections, import table
|
|
24
|
+
elf.py v2
|
|
25
|
+
macho.py v2
|
|
26
|
+
signature.py the three paths of section 3
|
|
27
|
+
strings.py extraction, then classification into URL / IP / host
|
|
28
|
+
models.py the result dataclasses
|
|
29
|
+
report.py console, JSON, Markdown
|
|
30
|
+
law_checker.py findings -> legal citations
|
|
31
|
+
law_cache.py from the family, unchanged
|
|
32
|
+
law_fetcher.py from the family, plus annexes and the Cellar source
|
|
33
|
+
utils.py
|
|
34
|
+
tests/
|
|
35
|
+
fixtures/ sample binaries, legal HTML
|
|
36
|
+
docker/smoke.py
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Two deliberate differences from apkradar:
|
|
40
|
+
|
|
41
|
+
**`formats/` is a subpackage from day one.** The name promises three platforms
|
|
42
|
+
while v1 delivers one. Splitting the parsers now makes ELF and Mach-O an
|
|
43
|
+
addition rather than a rewrite: `scanner.py` picks a parser by magic number and
|
|
44
|
+
works against a shared model.
|
|
45
|
+
|
|
46
|
+
**`report.py` is implemented.** In apkradar, `reporter.py`, `analyzer.py` and
|
|
47
|
+
`legal.py` are empty files and the `--output` option of `audit` is declared but
|
|
48
|
+
never read — only `batch-excel` writes anything. ExeRadar renders through one
|
|
49
|
+
module with three outputs, and `--output` infers the format from the extension.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 2. Dependencies
|
|
54
|
+
|
|
55
|
+
| Package | Why | Measured |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| `lief` | PE, ELF and Mach-O in one library | 1.0.0, July 2026, 76 wheels; installs on Python 3.14 through a `cp312-abi3` wheel |
|
|
58
|
+
| `asn1crypto` | RFC3161 timestamp decoding, and nothing else | 1.5.1, pure Python |
|
|
59
|
+
| `typer`, `rich` | CLI and console rendering, as the family | |
|
|
60
|
+
| `httpx` | `law_fetcher` | |
|
|
61
|
+
|
|
62
|
+
`pefile` was the obvious candidate and was rejected: its last release is
|
|
63
|
+
2024-08-26, it covers PE only, and pairing it with `pyelftools` and `macholib`
|
|
64
|
+
for v2 would mean three parsers with three models.
|
|
65
|
+
|
|
66
|
+
`asn1crypto` earns its place for one job. LIEF exposes the countersignature
|
|
67
|
+
structure but not the time inside it: the date lives in the TSTInfo and LIEF
|
|
68
|
+
does not decode the ASN.1. Everything else — headers, sections, imports,
|
|
69
|
+
certificate chain, `verify_signature()` — is LIEF.
|
|
70
|
+
|
|
71
|
+
`signify` was the first choice and was dropped after it failed on the Linux
|
|
72
|
+
runners with `LibraryNotFoundError: Error detecting the version of libcrypto`.
|
|
73
|
+
It depends on `oscrypto`, whose last release is 2022-03-18 and whose libcrypto
|
|
74
|
+
version detection does not cope with OpenSSL 3.x. asn1crypto parses the same
|
|
75
|
+
structure in pure Python, with no native library to find.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 3. `signature.py` — three paths, not one
|
|
80
|
+
|
|
81
|
+
This is the part the spike changed. An embedded signature and a signed file are
|
|
82
|
+
not the same thing.
|
|
83
|
+
|
|
84
|
+
### A. Embedded signature — LIEF — every platform
|
|
85
|
+
|
|
86
|
+
The Authenticode blob is inside the PE. LIEF parses it fully: digest algorithm,
|
|
87
|
+
the certificate chain with subjects, issuers, validity, serials and key usage,
|
|
88
|
+
the signer, the countersignature structure, and `verify_signature()`.
|
|
89
|
+
|
|
90
|
+
Measured on `notepad++.exe`: SHA-256 digest, a two-certificate chain from
|
|
91
|
+
GlobalSign to `CN=NOTEPAD++`, valid 2025-10-09 to 2028-10-09, an `MsCounterSign`
|
|
92
|
+
RFC3161 token carrying four certificates, and `VERIFICATION_FLAGS.OK`.
|
|
93
|
+
|
|
94
|
+
Two gaps to work around, both in the countersignature: the timestamp date is not
|
|
95
|
+
exposed, which is what `asn1crypto` is for, and `signers[0].cert` comes back
|
|
96
|
+
`None` even though the certificates are present in the structure.
|
|
97
|
+
|
|
98
|
+
### B. Catalog signature — Windows only
|
|
99
|
+
|
|
100
|
+
The file carries no signature at all; the signature lives in a `.cat` file under
|
|
101
|
+
`CatRoot` and covers the file by hash. Most Windows system binaries are signed
|
|
102
|
+
this way.
|
|
103
|
+
|
|
104
|
+
Measured on `C:\Windows\System32\notepad.exe`: LIEF reports **zero** embedded
|
|
105
|
+
signatures, while `Get-AuthenticodeSignature` reports
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
status Valid
|
|
109
|
+
type Catalog
|
|
110
|
+
OS binary True
|
|
111
|
+
signer CN=Microsoft Windows, O=Microsoft Corporation
|
|
112
|
+
timestamper CN=Microsoft Time-Stamp Service
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The file is validly signed and no PE parser can see it. Implementation is
|
|
116
|
+
`WinVerifyTrust` through `ctypes`, or a `Get-AuthenticodeSignature` subprocess;
|
|
117
|
+
the subprocess is the pragmatic first cut and the API is the version that does
|
|
118
|
+
not pay for a PowerShell start-up per file.
|
|
119
|
+
|
|
120
|
+
### C. No signature — a finding
|
|
121
|
+
|
|
122
|
+
Neither A nor B produced anything, on a platform where both could run. This is
|
|
123
|
+
the only case that is reported as a finding with a severity.
|
|
124
|
+
|
|
125
|
+
### The rule that follows
|
|
126
|
+
|
|
127
|
+
**On Linux and macOS, path B cannot run.** A and C still work, so an embedded
|
|
128
|
+
signature is still parsed and verified, but the absence of one is no longer
|
|
129
|
+
evidence of anything.
|
|
130
|
+
|
|
131
|
+
There the result is reported as:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
catalog signature: not verifiable on this platform
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
and **never** as `unsigned`. Calling a catalog-signed Microsoft binary unsigned
|
|
138
|
+
would be the worst false positive this tool could ship — it would fire on
|
|
139
|
+
exactly the files that are most obviously legitimate.
|
|
140
|
+
|
|
141
|
+
The same restraint applies inside a Linux container analysing Windows binaries,
|
|
142
|
+
which is the normal case in CI.
|
|
143
|
+
|
|
144
|
+
| | Embedded (A) | Catalog (B) | Verdict when both are empty |
|
|
145
|
+
| --- | --- | --- | --- |
|
|
146
|
+
| Windows | parsed and verified | verified | `unsigned` — a finding |
|
|
147
|
+
| Linux, macOS | parsed and verified | not verifiable | `unknown` — not a finding |
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 4. `law_checker` integration
|
|
152
|
+
|
|
153
|
+
The question this section opened with — what to cite for an artefact, when the
|
|
154
|
+
rest of the family cites the GDPR for the processing of personal data — has
|
|
155
|
+
been answered against the texts. The answer is the **Cyber Resilience Act**,
|
|
156
|
+
regulation (EU) 2024/2847, and it cost two changes to machinery that was
|
|
157
|
+
supposed to be reused unchanged.
|
|
158
|
+
|
|
159
|
+
### What the CRA actually says
|
|
160
|
+
|
|
161
|
+
Its articles do not contain the requirements. Article 6 allows a product on the
|
|
162
|
+
market only if it "meets the essential cybersecurity requirements set out in
|
|
163
|
+
Part I of Annex I", and article 13(1) puts that duty on the manufacturer;
|
|
164
|
+
both point at **Annex I** and stop. Citing them on their own would be citing a
|
|
165
|
+
pointer, so `law_fetcher` learned to address annexes: `"Allegato I, Parte I"`
|
|
166
|
+
is a fetchable unit, and its points resolve as `"Allegato I, Parte I(2)(f)"`.
|
|
167
|
+
The part belongs in the reference because Part I and Part II are both numbered
|
|
168
|
+
from (1).
|
|
169
|
+
|
|
170
|
+
The provision that carries the signature findings is Annex I, Part I(2)(f):
|
|
171
|
+
products shall *"proteggono l'integrità ... dei comandi, dei programmi e della
|
|
172
|
+
configurazione da qualsiasi manipolazione o modifica non autorizzata"*. A code
|
|
173
|
+
signature is how that integrity can be checked at all, so its absence, its
|
|
174
|
+
failure and the expiry of the key behind it are one requirement seen three
|
|
175
|
+
times.
|
|
176
|
+
|
|
177
|
+
### Where the text comes from
|
|
178
|
+
|
|
179
|
+
Not from `eur-lex.europa.eu` any more. That host now answers every automated
|
|
180
|
+
request with HTTP 202 and an AWS WAF challenge (`x-amzn-waf-action: challenge`)
|
|
181
|
+
— measured on the CRA and on the GDPR, in both languages, so it is the client
|
|
182
|
+
being refused and not the document being missing. The Publications Office
|
|
183
|
+
serves the same acts, in the same ELI markup, at
|
|
184
|
+
`publications.europa.eu/resource/celex/<CELEX>`, which is the interface that
|
|
185
|
+
exists for machines. `fetch_act_html` tries it first and falls back to the old
|
|
186
|
+
page, in case the rule is relaxed again.
|
|
187
|
+
|
|
188
|
+
**This affects the whole family**: APKRadar, MailRadar, PatchRadar and
|
|
189
|
+
CookieRadar all fetch through the blocked host and will cite from cache until
|
|
190
|
+
they take the same route.
|
|
191
|
+
|
|
192
|
+
### The mapping
|
|
193
|
+
|
|
194
|
+
| Finding | Cited |
|
|
195
|
+
| --- | --- |
|
|
196
|
+
| `unsigned` | CRA Annex I, Part I(2)(f); CRA art. 13(1); NIS2 art. 21(2)(d); GDPR art. 32(1) |
|
|
197
|
+
| `signature_invalid` | the same four |
|
|
198
|
+
| `certificate_expired` | CRA Annex I, Part I(2)(f); GDPR art. 32(1) |
|
|
199
|
+
| `hardcoded_ip` | CRA Annex I, Part I(2)(j) |
|
|
200
|
+
| `known_vulnerabilities` *(not produced yet)* | CRA Annex I, Part I(2)(a), Part II(1) and (2); NIS2 art. 21(2)(e) |
|
|
201
|
+
|
|
202
|
+
Three refusals are as much a part of the design as the citations.
|
|
203
|
+
|
|
204
|
+
- **No finding for `http://` URLs.** The obvious candidate was Annex I, Part
|
|
205
|
+
I(2)(e), confidentiality in transit. The only URL in this repository's own
|
|
206
|
+
fixture is `http://schemas.microsoft.com/SMI/2016/WindowsSettings`, an XML
|
|
207
|
+
namespace from the PE manifest — a finding that fires on every Windows
|
|
208
|
+
binary with a manifest is not a finding.
|
|
209
|
+
- **`hardcoded_ip` cites one provision and admits its weakness.** Part I(2)(j)
|
|
210
|
+
asks products to "limit attack surfaces, including external interfaces"; it
|
|
211
|
+
is a general requirement, not a rule about addresses, and the report says so
|
|
212
|
+
in a note rather than borrowing weight from a stronger article.
|
|
213
|
+
- **`unknown` signatures cite nothing.** Off Windows the catalog cannot be
|
|
214
|
+
consulted, so the absence of an embedded signature proves nothing. The whole
|
|
215
|
+
of section 3 exists to avoid that false positive, and a citation is an
|
|
216
|
+
accusation.
|
|
217
|
+
|
|
218
|
+
Two scope notes accompany every CRA citation, because both would otherwise
|
|
219
|
+
mislead: the regulation **applies from 11 December 2027** (art. 71(2)), so it is
|
|
220
|
+
in force and not yet applicable; and it binds a manufacturer placing a *product*
|
|
221
|
+
on the market (art. 2(1)), which is not something a PE header can establish
|
|
222
|
+
about a single file.
|
|
223
|
+
|
|
224
|
+
### What guards it
|
|
225
|
+
|
|
226
|
+
`test_every_citation_is_in_the_act` parses the acts and fails on a reference
|
|
227
|
+
they do not contain, so the map cannot drift into invention. It reads excerpts
|
|
228
|
+
of the real documents, cut from what the fetcher itself downloads; see
|
|
229
|
+
ATTRIBUTIONS.md.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## 5. Report
|
|
234
|
+
|
|
235
|
+
The model everything else derives from:
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
ExeResult
|
|
239
|
+
file path, size, sha256, format, arch, build timestamp
|
|
240
|
+
pe machine, subsystem, sections [name, size, entropy, characteristics]
|
|
241
|
+
imports [{dll, functions[]}] plus derived categories
|
|
242
|
+
(network, crypto, process, registry)
|
|
243
|
+
strings {url[], ip[], host[], path[]}
|
|
244
|
+
signature state (A / B / C / unknown), chain[], signer, validity,
|
|
245
|
+
timestamp, verification result
|
|
246
|
+
law LawCheckResult
|
|
247
|
+
findings [{id, severity, evidence}]
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Three outputs: **console** through Rich with a "Norme applicate" section at the
|
|
251
|
+
end, as mailradar and cookieradar do; **JSON**, which serialises the whole
|
|
252
|
+
`ExeResult` and is what makes the tool usable from a pipeline; **Markdown** for
|
|
253
|
+
pasting into a ticket.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## 6. v1 scope
|
|
258
|
+
|
|
259
|
+
| Feature | Module | Note |
|
|
260
|
+
| --- | --- | --- |
|
|
261
|
+
| PE header | `formats/pe.py` | machine, subsystem, sections, entropy |
|
|
262
|
+
| Import table | `formats/pe.py` | plus DLL categorisation, which is the value added |
|
|
263
|
+
| Readable strings | `strings.py` | ASCII and UTF-16LE, then classification |
|
|
264
|
+
| Certificates | `signature.py` | chain, issuer, subject, validity |
|
|
265
|
+
| Signature verification | `signature.py` | the three paths of section 3 |
|
|
266
|
+
| SHA-256 | `scanner.py` | of the file as given |
|
|
267
|
+
|
|
268
|
+
Section entropy is not on the original list and is kept anyway: it costs a few
|
|
269
|
+
lines and it is the single most informative signal per unit of effort, flagging
|
|
270
|
+
packed or encrypted binaries.
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## 7. Facts and findings
|
|
275
|
+
|
|
276
|
+
The other Radars reach a verdict because a provision is either respected or it
|
|
277
|
+
is not. An executable does not work that way: "imports `WinHttpConnect`" is not
|
|
278
|
+
a defect, it is a fact. A report that lists neutral observations without a
|
|
279
|
+
thesis is not worth reading.
|
|
280
|
+
|
|
281
|
+
So the report separates two registers:
|
|
282
|
+
|
|
283
|
+
- **Facts** — headers, imports, strings, hashes — always reported, never judged.
|
|
284
|
+
- **Findings** — unsigned, expired certificate, invalid signature, hardcoded IP
|
|
285
|
+
— carry a severity and may cite a provision.
|
|
286
|
+
|
|
287
|
+
Only findings reach `law_checker`.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 8. Later, not now
|
|
292
|
+
|
|
293
|
+
- NVD lookup for known vulnerabilities in identified components.
|
|
294
|
+
- Domain allowlist and blocklist comparison for extracted hosts.
|
|
295
|
+
- SBOM integration.
|
|
296
|
+
- ELF and Mach-O, through `formats/`.
|
|
297
|
+
|
|
298
|
+
Each of these is a reason the structure above is what it is; none of them is v1.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Attributions
|
|
2
|
+
|
|
3
|
+
Third-party material redistributed in this repository.
|
|
4
|
+
|
|
5
|
+
## `tests/fixtures/python.exe`
|
|
6
|
+
|
|
7
|
+
The CPython interpreter launcher for Windows, version 3.14, 106,208 bytes,
|
|
8
|
+
SHA-256 `4942b86a6597e5aee0128daa00050ed79bc21f6e709a78eb19cbfeb0c2f39ac9`.
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2001-2026 Python Software Foundation. All Rights Reserved.
|
|
11
|
+
|
|
12
|
+
Redistributed under the PSF License Agreement, reproduced in full in
|
|
13
|
+
[`tests/fixtures/python-LICENSE.txt`](tests/fixtures/python-LICENSE.txt), which
|
|
14
|
+
permits redistribution in binary form provided the copyright notice is
|
|
15
|
+
retained. Python is a trademark of the Python Software Foundation; its presence
|
|
16
|
+
here implies no endorsement of this project by the PSF.
|
|
17
|
+
|
|
18
|
+
### Why this file and not another
|
|
19
|
+
|
|
20
|
+
The tests need a real PE: headers with real section characteristics, a real
|
|
21
|
+
import table, and a real Authenticode signature. Three candidates were
|
|
22
|
+
rejected before this one.
|
|
23
|
+
|
|
24
|
+
- **notepad++.exe**, the first suggestion, is 8.1 MB and GPL. Redistributing it
|
|
25
|
+
from an MIT repository is a licence conflict, and it would sit in the git
|
|
26
|
+
history permanently.
|
|
27
|
+
- **Windows system binaries** are not redistributable at all.
|
|
28
|
+
- **The LIEF sample corpus** lives in `lief-project/samples`, which declares no
|
|
29
|
+
licence. No licence means no permission.
|
|
30
|
+
|
|
31
|
+
pefile's corpus is MIT but ships as one encrypted 64 MB archive, and LIEF's own
|
|
32
|
+
`tests/pe` directory holds no binaries — it pulls them from the unlicensed
|
|
33
|
+
samples repository.
|
|
34
|
+
|
|
35
|
+
Building a fixture instead of borrowing one was tried and abandoned: LIEF 1.0
|
|
36
|
+
cannot construct a `PE.Binary` from Python, and a hand-written minimal PE turns
|
|
37
|
+
into a PE writer, at which point the tests would be checking the writer rather
|
|
38
|
+
than the parser.
|
|
39
|
+
|
|
40
|
+
`python.exe` fits where the others did not: 104 KB, a permissive licence that
|
|
41
|
+
names redistribution explicitly, and a genuine embedded signature from the
|
|
42
|
+
Python Software Foundation with an RFC3161 countersignature.
|
|
43
|
+
|
|
44
|
+
### One property worth keeping
|
|
45
|
+
|
|
46
|
+
The signing certificate on this binary was valid from 2026-08-04 to 2026-08-07
|
|
47
|
+
— three days — and `verify_signature()` still returns OK today, well after it
|
|
48
|
+
expired. The countersignature proves the file was signed while the certificate
|
|
49
|
+
was valid, which is exactly what a countersignature is for.
|
|
50
|
+
|
|
51
|
+
That makes the fixture better than a freshly signed one: the test that asserts
|
|
52
|
+
a valid signature is already past the expiry date, so it cannot start failing
|
|
53
|
+
later for a reason that has nothing to do with this code.
|
|
54
|
+
|
|
55
|
+
## `tests/fixtures/*_excerpt.html` — EU law
|
|
56
|
+
|
|
57
|
+
Three excerpts of EU legal acts, used by the tests that check ExeRadar cites
|
|
58
|
+
provisions the acts really contain:
|
|
59
|
+
|
|
60
|
+
| File | Act | CELEX | Sections kept |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| `cra_it_excerpt.html` | Cyber Resilience Act, reg. (EU) 2024/2847 | `32024R2847` | art. 6, art. 13, Annex I |
|
|
63
|
+
| `gdpr_it_excerpt.html` | GDPR, reg. (EU) 2016/679 | `32016R0679` | art. 32 |
|
|
64
|
+
| `nis2_it_excerpt.html` | NIS2, dir. (EU) 2022/2555 | `32022L2555` | art. 21 |
|
|
65
|
+
|
|
66
|
+
Downloaded in Italian from the Publications Office of the European Union
|
|
67
|
+
(`publications.europa.eu/resource/celex/<CELEX>`), the same service
|
|
68
|
+
`law_fetcher` reads at runtime, and cut down to the sections the tests need.
|
|
69
|
+
The markup inside each file is the document's own: the excerpt is a slice, not
|
|
70
|
+
a reconstruction, so a test that passes against it is a test against the real
|
|
71
|
+
rendering.
|
|
72
|
+
|
|
73
|
+
Reuse of Commission documents is governed by Decision 2011/833/EU, which
|
|
74
|
+
permits reuse — including for commercial purposes — provided the source is
|
|
75
|
+
acknowledged and the meaning is not distorted. Only the authentic text
|
|
76
|
+
published in the *Official Journal of the European Union* has legal value;
|
|
77
|
+
these excerpts are test data and nothing in this repository is legal advice.
|