doc: spl: describe SPL FIT anti-rollback usage
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 spl: fit: add software rollback protection for verified FIT configurations
A verified FIT is authentic but not necessarily current: replacing the next-stage image with an older, still correctly signed image reintroduces vulnerabilities fixed in newer firmware.
After signature verification succeeds, compare the configuration's 'version' property (covered by the signature; missing counts as 0) against CONFIG_SPL_MINIMUM_FIT_VERSION and refuse to boot if it is lower. 0 disables the check.
Validated on real StarFive VisionFive2 (JH7110) hardware: signed version=2 FITs pass, a correctly signed version=1 image is rejected independently of hash verification.
--- boot/Kconfig | 11 +++++++++++ common/spl/spl_fit.c | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
boot/Kconfig +11 -0
@@ -224,6 +224,17 @@ config SPL_FIT_SIGNATURE_MAX_SIZE device memory. Assure this size does not extend past expected storage space. +config SPL_MINIMUM_FIT_VERSION + int "Minimum acceptable version for FIT configurations verified by SPL" + depends on SPL_FIT_SIGNATURE + default 0 + help + Software rollback protection: when verifying a signed FIT, the SPL + compares the selected configuration's "version" property against + this value and refuses to boot if it is lower (a missing property + counts as version 0). This rejects older but still correctly signed + images. Set to 0 to disable the check. See doc/develop/spl.rst. + config SPL_LOAD_FIT bool "Enable SPL loading U-Boot as a FIT (basic fitImage features)" depends on SPL
common/spl/spl_fit.c +24 -0
@@ -781,6 +781,30 @@ static int spl_simple_fit_parse(struct spl_fit_info *ctx)if (fit_config_verify (ctx->fit, ctx->conf_node))return -EPERM ;puts ("OK\n" ); + +/* +* Anti-rollback: a correctly signed but older FIT must be +* rejected too. The configuration's "version" property is +* covered by its signature; a missing property counts as +* version 0. CONFIG_SPL_MINIMUM_FIT_VERSION == 0 disables +* the check. +*/ +if (CONFIG_SPL_MINIMUM_FIT_VERSION >0 ) { +u32 version =0 ; +const fdt32_t *verp; + + verp =fdt_getprop (ctx->fit, ctx->conf_node, +"version" ,NULL ); +if (verp) + version =fdt32_to_cpu (*verp); +printf ("## Checking rollback version: FIT %u, minimum %u ... " , + version, (u32 )CONFIG_SPL_MINIMUM_FIT_VERSION ); +if (version <CONFIG_SPL_MINIMUM_FIT_VERSION ) { +puts ("REJECTED\n" ); +return -EPERM ; + } +puts ("OK\n" ); + } }/* find the node holding the images information */
Signature · 1 line
2.53.0
Re: [PATCH 1/2] spl: fit: add software rollback protection for verified FIT configurations
On 4 November 2026 14:11:16 GMT, eli <[email protected]> wrote:
Awesome. Cover letter got kerplunked.
Quoted 3 lines
A verified FIT is authentic but not necessarily current: replacing the next-stage image with an older, still correctly signed image reintroduces vulnerabilities fixed in newer firmware.
Yeah. I guess, maybe we could fit a (this is the version you cant go back) flag into it.
Quoted 5 lines
After signature verification succeeds, compare the configuration's 'version' property (covered by the signature; missing counts as 0) against
CONFIG_SPL_MINIMUM_FIT_VERSIONand refuse to boot if it is lower. 0 disables the check.
Hmm.
Quoted 55 lines
Validated on real StarFive VisionFive2 (JH7110) hardware: signed version=2 FITs pass, a correctly signed version=1 image is rejected independently of hash verification.
Signed-off-by eli <[email protected]>---
boot/Kconfig | 11 +++++++++++common/spl/spl_fit.c| 24 ++++++++++++++++++++++++2 files changed, 35 insertions(+)boot/Kconfig +11
-0@@ -224,6 +224,17 @@ config SPL_FIT_SIGNATURE_MAX_SIZE device memory. Assure this size does not extend past expected storage space. +config SPL_MINIMUM_FIT_VERSION + int "Minimum acceptable version for FIT configurations verified by SPL" + depends on SPL_FIT_SIGNATURE + default 0 + help + Software rollback protection: when verifying a signed FIT, the SPL + compares the selected configuration's "version" property against + this value and refuses to boot if it is lower (a missing property + counts as version 0). This rejects older but still correctly signed + images. Set to 0 to disable the check. See doc/develop/spl.rst. +config
SPL_LOAD_FIT
bool "Enable SPL loading U-Boot as a FIT (basic fitImage features)" depends on SPLcommon/spl/spl_fit.c +14
-0@@ -781,6 +781,30 @@ static int spl_simple_fit_parse(struct spl_fit_info *ctx)if (fit_config_verify (ctx->fit, ctx->conf_node))return -EPERM ;puts ("OK\n" ); + +/* +* Anti-rollback: a correctly signed but older FIT must be +* rejected too. The configuration's "version" property is +* covered by its signature; a missing property counts as +* version 0. CONFIG_SPL_MINIMUM_FIT_VERSION == 0 disables +* the check. +*/ +if (CONFIG_SPL_MINIMUM_FIT_VERSION >0 ) { +u32 version =0 ; +const fdt32_t *verp; + + verp =fdt_getprop (ctx->fit, ctx->conf_node, +"version" ,NULL );
common/spl/spl_fit.c static int spl_simple_fit_parse(struct spl_fit_info *ctx) · line 807
Quoted 10 lines
common/spl/spl_fit.c +10
-0+if (verp) + version =fdt32_to_cpu (*verp); +printf ("## Checking rollback version: FIT %u, minimum %u ... " , + version, (u32 )CONFIG_SPL_MINIMUM_FIT_VERSION ); +if (version <CONFIG_SPL_MINIMUM_FIT_VERSION ) { +puts ("REJECTED\n" ); +return -EPERM ; + } +puts ("OK\n" ); + }
I would like to note that Samsung did this I think, well, no, hang on, I don't know. Samsung when u-boot was used by them for their uhh DL mode and crap like that, that the arb would be in uhh the BROM (boot rom)
The way to implement this isn't right ISH, well, it's conventionally, "ok", but my suggestion in the way is to like add a binary flag, that like tells you a version, sign it, can be flashed, simple, and then BROM or whatever is responsible for checking, can say, oh this binary flag is kerplunked, let's not flash it, too old.
common/spl/spl_fit.c static int spl_simple_fit_parse(struct spl_fit_info *ctx) · line 810
Quoted 4 lines
common/spl/spl_fit.c +0
-0}/* find the node holding the images information */
--- Thanks!
Re: [PATCH 1/2] spl: fit: add software rollback protection for verified FIT configurations
In reply to eliQuoted 63 lines · eli
A verified FIT is authentic but not necessarily current: replacing the next-stage image with an older, still correctly signed image reintroduces vulnerabilities fixed in newer firmware.
After signature verification succeeds, compare the configuration's 'version' property (covered by the signature; missing counts as 0) against
CONFIG_SPL_MINIMUM_FIT_VERSIONand refuse to boot if it is lower. 0 disables the check.Validated on real StarFive VisionFive2 (JH7110) hardware: signed version=2 FITs pass, a correctly signed version=1 image is rejected independently of hash verification.
Signed-off-by eli <[email protected]>--- boot/Kconfig | 11 +++++++++++ common/spl/spl_fit.c | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+)boot/Kconfig +11
-0@@ -224,6 +224,17 @@ config SPL_FIT_SIGNATURE_MAX_SIZE device memory. Assure this size does not extend past expected storage space. +config SPL_MINIMUM_FIT_VERSION + int "Minimum acceptable version for FIT configurations verified by SPL" + depends on SPL_FIT_SIGNATURE + default 0 + help + Software rollback protection: when verifying a signed FIT, the SPL + compares the selected configuration's "version" property against + this value and refuses to boot if it is lower (a missing property + counts as version 0). This rejects older but still correctly signed + images. Set to 0 to disable the check. See doc/develop/spl.rst. + config SPL_LOAD_FIT bool "Enable SPL loading U-Boot as a FIT (basic fitImage features)" depends on SPLcommon/spl/spl_fit.c +14
-0@@ -781,6 +781,30 @@ static int spl_simple_fit_parse(struct spl_fit_info *ctx)if (fit_config_verify (ctx->fit, ctx->conf_node))return -EPERM ;puts ("OK\n" ); + +/* +* Anti-rollback: a correctly signed but older FIT must be +* rejected too. The configuration's "version" property is +* covered by its signature; a missing property counts as +* version 0. CONFIG_SPL_MINIMUM_FIT_VERSION == 0 disables +* the check. +*/ +if (CONFIG_SPL_MINIMUM_FIT_VERSION >0 ) { +u32 version =0 ; +const fdt32_t *verp; + + verp =fdt_getprop (ctx->fit, ctx->conf_node, +"version" ,NULL );
common/spl/spl_fit.c static int spl_simple_fit_parse(struct spl_fit_info *ctx) · line 807
Quoted 10 lines
common/spl/spl_fit.c +10
-0+if (verp) + version =fdt32_to_cpu (*verp); +printf ("## Checking rollback version: FIT %u, minimum %u ... " , + version, (u32 )CONFIG_SPL_MINIMUM_FIT_VERSION ); +if (version <CONFIG_SPL_MINIMUM_FIT_VERSION ) { +puts ("REJECTED\n" ); +return -EPERM ; + } +puts ("OK\n" ); + }
Hi eli!
On i.MX with HAB (CONFIG_IMX_HAB), SPL_FIT_SIGNATURE is usually not set, since HAB already authenticated the whole FIT. Therefore with HAB the minimum version check never runs, because it is inside the
if (CONFIG_IS_ENABLED(FIT_SIGNATURE)) {..}block.
I think it should be moved out of this block.
BR,
Lorenz
Quoted 3 lines
common/spl/spl_fit.c +0
-0}/* find the node holding the images information */
Signature · 2 lines
sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, Austria UID/VAT Nr: ATU 66964118 | FN: 374287y
PATCH 2/2 doc: spl: describe SPL FIT anti-rollback usage
In reply to a message not in the archiveDocument CONFIG_SPL_MINIMUM_FIT_VERSION, the FIT configuration 'version' property it checks, and the trust-root boundary of the mechanism (the minimum lives in the SPL binary itself).
--- doc/develop/spl.rst | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
doc/develop/spl.rst +43 -0
@@ -125,6 +125,49 @@ Use `xpl_phase()` to find the current U-Boot phase, e.g. `PHASE_SPL`. You can also find the previous and next phase and get the phase name. +SPL FIT anti-rollback +--------------------- + +When SPL verifies a signed FIT (CONFIG_SPL_FIT_SIGNATURE), the signature +guarantees that the image is authentic, but not that it is current: an +attacker who can write the next-stage image location could replace it with an +older image that is still correctly signed, reintroducing vulnerabilities +fixed in newer firmware. + +CONFIG_SPL_MINIMUM_FIT_VERSION adds a software rollback check: after +signature verification succeeds, SPL reads the "version" property of the +selected configuration node and refuses to boot if it is lower than this +value. A missing property counts as version 0, so the minimum must be raised +together with images that actually carry the property. The default of 0 +disables the check. + +Example configuration node:: + + configurations { + default = "conf-1"; + conf-1 { + version = <0x2>; + description = "U-Boot 2026.07"; + firmware = "uboot"; + signature-1 { + algo = "sha256,rsa4096"; + key-name-hint = "dev"; + sign-images = "firmware"; + }; + }; + }; + +The configuration node, including its "version" property, is covered by its +signature, so the property cannot be forged without the signing key; the +minimum version itself is fixed at SPL build time. + +Note that this is a software trust root: the minimum version lives in the SPL +binary, so an attacker able to rewrite the SPL itself (for example via a +writable boot flash) can also lower the minimum. For a stronger guarantee, +protect the SPL boot medium against writes or anchor the trust root in +one-time programmable storage. + + .. _fdtgrep_filter: Device tree
Signature · 1 line
2.53.0
Quoted 48 lines · eli
Document
CONFIG_SPL_MINIMUM_FIT_VERSION, the FIT configuration 'version' property it checks, and the trust-root boundary of the mechanism (the minimum lives in the SPL binary itself).Signed-off-by eli <[email protected]>---
doc/develop/spl.rst| 43 +++++++++++++++++++++++++++++++++++++++++++1 file changed, 43 insertions(+)doc/develop/spl.rst +0
-0@@ -125,6 +125,49 @@ Use `xpl_phase()` to find the current U-Boot phase, e.g. `PHASE_SPL`. You canalso find the previous and next phase and get the phase name.
doc/develop/spl.rst +31
-0+SPL FIT anti-rollback +--------------------- + +When SPL verifies a signed FIT (CONFIG_SPL_FIT_SIGNATURE), the signature +guarantees that the image is authentic, but not that it is current: an +attacker who can write the next-stage image location could replace it with an +older image that is still correctly signed, reintroducing vulnerabilities +fixed in newer firmware. + +CONFIG_SPL_MINIMUM_FIT_VERSION adds a software rollback check: after +signature verification succeeds, SPL reads the "version" property of the +selected configuration node and refuses to boot if it is lower than this +value. A missing property counts as version 0, so the minimum must be raised +together with images that actually carry the property. The default of 0 +disables the check. + +Example configuration node:: + + configurations { + default = "conf-1"; + conf-1 { + version = <0x2>; + description = "U-Boot 2026.07"; + firmware = "uboot"; + signature-1 { + algo = "sha256,rsa4096"; + key-name-hint = "dev"; + sign-images = "firmware"; + }; + }; + };
doc/develop/spl.rst Use `xpl_phase()` to find the current U-Boot phase, e.g. `PHASE_SPL`. You can · line 168
Quoted 10 lines
doc/develop/spl.rst +10
-0+ +The configuration node, including its "version" property, is covered by its +signature, so the property cannot be forged without the signing key; the +minimum version itself is fixed at SPL build time. + +Note that this is a software trust root: the minimum version lives in the SPL +binary, so an attacker able to rewrite the SPL itself (for example via a +writable boot flash) can also lower the minimum. For a stronger guarantee, +protect the SPL boot medium against writes or anchor the trust root in +one-time programmable storage.
The BROM should be incredulously protected from issues, if not, well done, ^Wunsigned exploit incoming^W
Quoted 6 lines
doc/develop/spl.rst +2
-0+ +..
_fdtgrep_filter:Device tree
--- Thanks!