ARMmbed / suit-manifest-generator

Apache License 2.0
18 stars 9 forks source link

Security issues in the parser and bootloader code #17

Open mjurczak opened 4 years ago

mjurczak commented 4 years ago

Hello,

I'm worried the input validation and pointer operations in the code may be insufficient for security critical code such as secure-bootloaders at the moment.

More comments and sample inputs exploiting found issues can be found at: https://github.com/mjurczak/suit-manifest-generator/pull/1

I believe the code is a great candidate for static code analysis and perhaps fuzz testing, which may reveal further issues. It would be great to employ and encourage defensive programming techniques by default in secure bootloader code samples.

bremoran commented 4 years ago

Definitely! Is this sufficiently clear? https://github.com/ARMmbed/suit-manifest-generator/tree/master/parser_examples#warnings

mjurczak commented 4 years ago

The warning is absolutely clear! The trick seems to be to find all the known and yet unknown issues.

I did a quick exercise with static analyzers: https://github.com/mjurczak/suit-manifest-generator/commit/05092b1a3bdcf23e25159079ec0a526e29f7242c to see what issues can be found with such approach. I think that, apart from code review, fuzzing seems to be most promising in automated finding of such problems.