Skip to content

Supplement device-property ids from system properties when unattested - #258

Merged
JingMatrix merged 4 commits into
devfrom
fix/harvest-device-props-fallback
Aug 17, 2026
Merged

Supplement device-property ids from system properties when unattested#258
JingMatrix merged 4 commits into
devfrom
fix/harvest-device-props-fallback

Conversation

@JingMatrix

Copy link
Copy Markdown
Owner

brand/device/product/manufacturer/model are captured from the attested leaf, and Resolver presented harvest.<id> raw. A device that produced no device-ID attestation — a plain attestation, or a TEE that refuses ID attestation — leaves all five blank, so the profile presented an empty id, and the reference TA's ID check then rejects an app that requests the device's true value ("attestation ID mismatch for brand"). serial/imei/imei2/meid were already supplemented from the OS; these five were not, even though they are exactly the ids the framework fills ATTESTATION_ID_* from.

When the captured value is blank, the harvest now fills each from the android.os.Build field the framework itself reads for ID attestation — which resolves from the ro.product.* system properties — recorded as a SUPPLEMENT override. Resolver presents effective() for every id, so a supplemented value reaches the TA while a real capture stays untouched, the WebUI shows the supplement for what it is, and an explicit per-profile spoof still overrides it.

@kukIux

kukIux commented Aug 17, 2026

Copy link
Copy Markdown

Screenshot_20260817-164147_kknd Detector.png

Screenshot_20260817-164205_Key Attestation.png

@kukIux

kukIux commented Aug 17, 2026

Copy link
Copy Markdown

Screenshot_20260817-165207_Duck Detector.png

@JingMatrix

Copy link
Copy Markdown
Owner Author

Hi @kukIux — the device-id fix is ready. Could you retest on the LineageOS device (Redmi Note 13 / sapphire) where Key Attestation failed with "attestation ID mismatch for device"?

Debug build TEESimulator-v4.0-59-3296655-Debug:
https://github.com/JingMatrix/TEESimulator/actions/runs/32043772359/artifacts/9292512629

Please install it, run Key Attestation with the same options as before, and check whether the ID mismatch is gone — then attach the log and a screenshot. Thanks!

@kukIux

kukIux commented Aug 17, 2026

Copy link
Copy Markdown

Thank you. This CI build, fixed detect Tee in latest kknd detector, and fix view Attestation device props in my Redmi Note 13 on Key Attestation 2.0.3 app!

@kukIux

kukIux commented Aug 17, 2026

Copy link
Copy Markdown

Screenshot_20260817-220733_Key Attestation.png

Screenshot_20260817-220743_Key Attestation.png

Screenshot_20260817-220803_kknd Detector.png

brand/device/product/manufacturer/model are captured from the attested leaf, and Resolver
presented harvest.<id> raw. A device that produced no device-ID attestation — a plain
attestation, or a TEE that refuses ID attestation — leaves all five blank, so the profile
presented an empty id, and the reference TA's ID check then rejects an app that requests the
device's true value ("attestation ID mismatch for brand"). serial/imei/imei2/meid were already
supplemented from the OS; these five were not, even though they are exactly the ids the
framework fills ATTESTATION_ID_* from.

When the captured value is blank, the harvest now fills each from the android.os.Build field
the framework itself reads for ID attestation — which resolves from the ro.product.* system
properties — recorded as a SUPPLEMENT override. Resolver presents effective() for every id, so
a supplemented value reaches the TA while a real capture stays untouched, the WebUI shows the
supplement for what it is, and an explicit per-profile spoof still overrides it.
The first cut read plain android.os.Build.BRAND/DEVICE/PRODUCT/... to supplement an
unattested id. That is the wrong source: keystore does not attest those. The framework's
AndroidKeyStoreKeyPairGeneratorSpi fills ATTESTATION_ID_* from Build.<X>_FOR_ATTESTATION,
and Build.getVendorDeviceIdProperty resolves that as
ro.product.<base>_for_attestation (unless "unknown") -> else ro.product.vendor.<base> ->
else ro.product.<base>, where <base> is brand/device/name(product)/manufacturer/model.

On a ROM that ships attestation-specific ids these differ from the plain values: a
LineageOS build reported ro.product.device_for_attestation=sapphire while ro.product.device
=sapphiren, so we supplemented "sapphiren" while the app requested "sapphire" and the TA's
id check still failed. devicePropId now mirrors that exact chain, so a supplemented id
equals what the caller attests. It reads the properties directly (SystemProperties, no
hidden Build.<X>_FOR_ATTESTATION field), returning blank only when the whole chain is
unset so nothing garbage is supplemented.
@JingMatrix
JingMatrix force-pushed the fix/harvest-device-props-fallback branch from e3e6a8e to c586712 Compare August 17, 2026 23:29
@JingMatrix
JingMatrix merged commit 11fe93a into dev Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants