Asserts considered harmful (or GMP spills its sensitive information)

Marco Bodrato bodrato at mail.dm.unipi.it
Thu Jan 3 19:55:43 UTC 2019


Ciao,

Il Lun, 31 Dicembre 2018 7:03 pm, Jeffrey Walton ha scritto:
[...skipping opinions...]

> Here's a small example of triggering an assert using the Nettle
> library.

This absolutely is NOT a "small example", it requires to build two entire
libraries!
Anyway we analysed it, see below.

> ARM A-32 does not work at the moment due to GMP build errors.

Can we suggest you to read the GMP manual on how to build the library?
GMP works fine on many ARM configurations we test and there are lots of
projects out there (eg. many GNU/Linux distributions) that builds GMP for
different ARM processors.

> In the case below Nettle is using benign data and not maliciously
> crafted data.

I'm sorry, but your analysis was incorrect.

I agree, Nettle is not using "maliciously crafted data", but I do not
agree when you say that it "is using benign data".

With your build options, Nettle calls the GMP function mpn_sec_powm with
an invalid parameter: ebn = 0.

Because of an error in the Nettle library you built, GMP receives "non
benign data". To avoid further memory corruptions, GMP aborts.

Thanks to this behaviour of GMP, you was able to catch the incorrect built
of the library using it. ;-)

Using mpn_sec_powm with an exponent of zero bits is obviously a nonsense,
and in general the documentation of GMP clearly says that arguments of
size zero are not supported.

On GMP side, we can only specify even more explicitly in the documentation
of that function the need for non-zero sized arguments.

Ĝis,
m

-- 
http://bodrato.it/papers/



More information about the gmp-bugs mailing list