Repository navigation
Description
Design: a defect-pattern class for defect finders
1. Motivating example
Auditing the openSUSE rsync 3.5.1 package, rpmcrab reported
binary-or-shlib-calls-gethostbyname at W on /usr/bin/rsync. Triage of
that one warning:
- The call site is
access.c:68,match_hostname()in the rsync
daemon: ahosts allow/hosts denyhostname token is
forward-resolved withgethostbyname(), which returns IPv4 addresses
only, and the results are string-compared against the peer's numeric
address. - For an IPv6 peer the comparison can never succeed. In
hosts allow
the client is locked out (the visible half, tracked upstream since
2024 as rsyncd.conf 'host allow' entries don't work properly for DNS entries with IPV6 addresses RsyncProject/rsync#563). Inhosts denythe same client is
admitted — the deny rule silently fails open for IPv6. - The fail-open half is the failure class upstream's recent CVE work
hardened in this same function: CVE-2026-43617 (reverse path) and
CVE-2026-70452 (unresolvable deny tokens made to fail closed). The
resolvable-but-AAAA-only gap is the piece that work left standing. - Outcome: upstream PR
RsyncProject/rsync#1140
(Fixes #563), convertingmatch_hostname()togetaddrinfo();
verified with a loopback daemon matrix (IPv4 identical in all cells,
IPv6 corrected in both) and the full upstream testsuite
(278 passed / 0 failed).
A generic W in a large warning population carried a genuine,
shippable security defect. The class below exists so that findings
with this shape are grouped, described and gated as what they are:
decidable defect patterns with a recorded defect history, presented
separately from general lint noise so the triage actually happens.
2. Today's inventory
The seed members already exist, scattered through BinariesCheck with
no shared identity. Levels are the test-pinned census values
(crates/rpmcrab-core/tests/data/severity-inventory.txt, 334 tags);
emission is Rust in crates/rpmcrab-core/src/checks/binaries.rs,
descriptions in crates/rpmcrab-core/data/descriptions/BinariesCheck.toml.
Pattern finders (dangerous-API / call-pattern):
| tag | level | pattern |
|---|---|---|
binary-or-shlib-calls-gethostbyname |
W | dynamic-symbol match over the legacy resolver family (gethostbyname{,2}, gethostbyaddr, and the _r forms) |
call-to-mktemp |
E | mktemp-family call; archives charge an undefined reference only, linked objects any match (#852) |
missing-call-to-setgroups-before-setuid |
W | setuid/setgid calls present, setgroups/initgroups absent |
Hardening family (mitigation-absence, same check):
| tag | level |
|---|---|
missing-fortify |
W |
missing-stack-protector |
W |
missing-relro |
W |
partial-relro |
W |
missing-cf-protection |
W |
executable-stack |
E |
non-position-independent-executable |
E |
Measured evidence on record: the #852 corpus measurement for
call-to-mktemp (460 E in 52 source packages before scoping, 74 E in
41 after, every firing file independently classified) and the #743
rationale keeping missing-call-to-setgroups-before-setuid at W (the
symbol pattern cannot separate the unsafe form from the safe
drop-to-real-ids idiom). binary-or-shlib-calls-gethostbyname has its
rsync instance (§1) and gains its corpus measurement in the pilot
(§6, P1).
3. The class
A defect-pattern finder pairs:
- a pattern decidable from the shipped binary and package —
dynamic symbols, embedded strings, section and file facts, package
relationships; with - a context gate over facts the same run already establishes:
- Privilege: the file carries setuid/setgid mode bits or file
capabilities (the package model already parsesRPMTAG_FILECAPS,
crates/rpmcrab-core/src/pkg/mod.rs). - Exposure: the checked package ships daemon surface — systemd
service or socket unit files in its own file list. - No-safe-use: patterns whose legitimate modern use is empty
(call-to-mktemptoday) carry no gate.
- Privilege: the file carries setuid/setgid mode bits or file
Severity follows the combination. The bare pattern reports at W
inside the class. A gated form (pattern × privilege, pattern ×
exposure) reports at the level its measured precision earns (§5).
Class membership is a property of the finding tag, recorded once in
the registry (§4), so every consumer — output, filtering, docs —
reads the same source.
Initial severity matrix (P0 changes no level; the right column is the
pilot's question, not a preset):
| finder | bare | gated |
|---|---|---|
binary-or-shlib-calls-gethostbyname |
W | E candidate at privilege/exposure (P1 measurement decides) |
call-to-mktemp |
E (no-safe-use, ungated) | — |
missing-call-to-setgroups-before-setuid |
W (self-gated by construction) | stays W per #743 |
| hardening family | today's levels | unchanged |
4. Presentation
Registry. One embedded data file beside the existing check data
(crates/rpmcrab-core/data/defect-patterns.toml), one record per
member tag: class, family (pattern / hardening), gate shape, and
provenance — the motivating defect samples (CVE identifiers,
advisory references, or a verified in-distro instance such as §1) that
put the finder on the on-ramp. The registry is the single source for
everything below.
JSON. Finding::json_value() gains "class": "defect-pattern"
on member findings (absent on others, mirroring the existing
null/absent conventions), resolved from the registry when the
Filter retains the finding — every finding already passes through
add_info, so check code stays untouched. The JSON summary gains a
per-class count next to the existing errors/warnings/filtered
counters (crates/rpmcrab-core/src/render.rs).
Text. The finding line (§4.1) and the filter-match string (§4.2)
keep their frozen shapes. Class presentation in text is the summary
block (§4.5): a per-class count line, landed as a deliberate
frozen-shape amendment with its golden tests updated in the same
diff. -v descriptions for member tags carry the class and the
recorded provenance, so the explanation a maintainer reads names the
defect history behind the pattern.
rpmlintrc. Filters stay regexes over the match string (§4.2). The
registry makes one addition exact: a filter written as
class:defect-pattern expands, when the Filter is built, into the
member-tag alternation from the registry — suppression at class
granularity with the same emit-time semantics as every other filter
(§4.3). [SeverityOverrides] continues to key on individual tags;
per-class overrides are a later step (§7).
Ledger. A behaviour change to a member finder (a new gate, a
level change) is a divergence-ledger entry in the established form
(tests/parity/divergences.toml, kind = "behaviour", measured
before/after counts in the reason — #852 is the template) and updates
the severity census in the same diff, as today.
5. Precision machinery: the on-ramp
Every finder, seed or new, carries the same bar — the project's
existing corpus and ledger infrastructure applied per finder:
- Motivating samples. At least one recorded defect instance: a
CVE/advisory root cause in the pattern's class, or a verified
in-distro instance. Recorded in the registry provenance. - Corpus measurement. A Factory-corpus run before and after,
reporting the firing population per gate (bare / privilege /
exposure), with false-positive sampling of the firing set — the
BinariesCheck: call-to-mktemp charges the C library that defines mktemp (cross newlib archives) #852 method, where every firing file in the measured population
was independently classified. - Near-miss negatives. Tests pinning the shapes that stay quiet:
the lookalike that must still fire and the legitimate form that
must not (the standard the recent debug-payload and ghost fixes
set). - W until earned. A finder ships at W. Its gated form reaches E
only with the measurement from (2) in its ledger entry showing
the gated population is the defect population.
6. Rollout
- P0 — scaffolding and reclassification. The registry, the JSON
class field and summary count, the text summary line, the
class:filter expansion,-vprovenance text, and the §2
inventory registered. Presentation only: emitted findings, levels
and the severity census are unchanged. Lands as: one PR for the
registry + JSON/text/filter plumbing, one PR registering the
inventory and its docs. A DESIGN.md amendment recording the class
follows agreement in principle on this issue, in the §4.6/§4.9/§9
pattern. - P1 — the gethostbyname pilot. Privilege and exposure gates in
BinariesCheck forbinary-or-shlib-calls-gethostbyname; the
corpus split measurement over Factory (population per gate, FP
sampling); rsync as the worked case in the PR. The gated form
takes the level the measurement supports, ledgered per §4. - P2 — candidate mining. Method: take SUSE and Fedora CVE fixes
over a trailing window, extract the root-cause pattern of each,
and keep the ones that reduce to a binary-decidable predicate
(symbol sets, section facts, string artefacts, file facts).
Rank survivors by decidability, then by defect severity, then by
firing population. The mining pass produces the ranked candidate
list; each candidate then enters the §5 on-ramp individually. - P3 — steady state. The on-ramp is the standing route for new
finders; the per-release corpus reports carry the class counts by
finder and gate, so precision drift is visible release over
release.
P0 and the DESIGN amendment wait on the design ack here; P1's gate
implementation follows P0's registry.
7. Open questions
- Class name. Recommended:
defect-pattern. It names the
mechanism (a decidable pattern with a defect history); CVE stays
in the provenance field, since motivating samples include
in-distro finds with no CVE attached. - JSON field shape. Recommended: a single optional string,
"class", present on member findings only; the registry enforces
one class per tag, so no array is needed. - Class-level rpmlintrc filtering in P0 or later. Recommended:
P0. Suppression at class granularity is the class's user-facing
point (the fair-case route for a gated finding is a class
filter with a reason, as the branding demotion's wording work
assumes); the registry makes the expansion exact, and
[SeverityOverrides]by class is the part that defers. - E-eligibility. Recommended: gated forms only — a finder
reaches E exclusively in a gated form whose full-corpus
measurement is recorded in its ledger entry; the bare pattern
stays W. Once a gated E exists, the openSUSE flavour's
BlockedFiltersis the available lever for keeping it
unsuppressable in distribution builds. - Hardening family membership. Recommended: in, as the
hardeningfamily of the same class and registry — mitigation
absence is the same triage audience and the same provenance
shape; levels stay as measured today.
Activity
feat(defect-pattern): registry, class resolution and class filters
feat(defect-pattern): registry, class resolution and class filters
feat(defect-pattern): registry, class resolution and class filters
feat(defect-pattern): registry, class resolution and class filters
feat(defect-pattern): registry, class resolution and class filters
feat(binaries): gate gethostbyname on privilege and exposure
docs(ledger): record the gethostbyname gate measurement
docs(design): record the defect-pattern class
feat(binaries): report weak PRNG calls in privileged or daemon binaries
feat(binaries): report legacy crypto primitive calls (MD5, DES, RC4)
feat(binaries): report legacy crypto primitive calls (MD5, DES, RC4)
feat(binaries): warn on Go binaries built with an outdated toolchain
feat(defect-pattern): register go-toolchain-outdated
feat(binaries): warn on Go binaries built with an outdated toolchain
feat(defect-pattern): register go-toolchain-outdated
10 remaining items
feat(binaries): report weak PRNG calls in privileged or daemon binaries
feat(binaries): report unbounded string copy/format calls
feat(binaries): gate gethostbyname on privilege and exposure
docs(ledger): record the gethostbyname gate measurement
docs(design): record the defect-pattern class
feat(binaries): gate gethostbyname on privilege and exposure
docs(ledger): record the gethostbyname gate measurement
docs(design): record the defect-pattern class
feat(binaries): report unbounded string copy/format calls
feat(binaries): report unbounded string copy/format calls
feat(binaries): fire shell-execution calls behind the privilege/expos…
feat(binaries): fire shell-execution calls behind the privilege/expos…
feat(binaries): fire shell-execution calls behind the privilege/expos…
scarabeusiv commentedon Oct 27, 2026
Closing as completed — the design landed and every finder it specified has shipped:
One boundary from the design is worth restating here: the gates are per-package by construction — a finder sees a single built RPM, so a pattern split across packages (the CVE-2025-10230 shape:
system()reference in samba-client-libs, the daemon in samba) does not fire. That is a documented limit of the class, not an open item.