Skip to contentSkip to conversation

tests: FIT: Add "clone" image attack image test

PATCH In review Tom Rini 1 participant 2 messages Mar 18 – Mar 23

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 tests: FIT: Add "clone" image attack image test

Related to the problem resolved with commit 2092322b31cc ("boot: Add fit_config_get_hash_list() to build signed node list"), add a testcase for the problem as well.

Reported-by Apple Security Engineering and Architecture (SEAR)

---
Apple has confirmed that we can include the test case now, rather than waiting.

---
 test/py/tests/test_vboot.py | 10 ++++++
 test/py/tests/vboot_evil.py | 65 +++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)
test/py/tests/test_vboot.py +10 -0
index 19f3f981379e..55518bed07e9 100644
@@ -372,6 +372,16 @@ def test_vboot(ubman, name, sha_algo, padding, sign_options, required,
             msg = 'Signature checking prevents use of unit addresses (@) in nodes'
             run_bootm(sha_algo, 'evil kernel@', msg, False, efit)
 
+            # Try doing a clone of the images
+            efit = '%stest.evilclone.fit' % tmpdir
+            shutil.copyfile(fit, efit)
+            vboot_evil.add_evil_node(fit, efit, evil_kernel, 'clone')
+
+            utils.run_and_log_expect_exception(
+                ubman, [fit_check_sign, '-f', efit, '-k', dtb],
+                1, 'Failed to verify required signature')
+            run_bootm(sha_algo, 'evil clone', 'Bad Data Hash', False, efit)
+
         # Create a new properly signed fit and replace header bytes
         make_fit('sign-configs-%s%s.its' % (sha_algo, padding), ubman, mkimage, dtc_args, datadir, fit)
         sign_fit(sha_algo, sign_options)
test/py/tests/vboot_evil.py +65 -0

89 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#1 lore raw
Quoted 5 lines · Tom Rini

Related to the problem resolved with commit 2092322b31cc ("boot: Add fit_config_get_hash_list() to build signed node list"), add a testcase for the problem as well.

Applied to u-boot/master, thanks!

[1/1] tests: FIT: Add "clone" image attack image test

      commit: a22e9e1b8ec7c96664072d7e629e811c318fb92a
Signature · 1 line
Tom