You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside parseString, the arguments data, and num_components are entirely user controlled. They are added together with base and used to check if we can safely read the contents of our string inside our given len. The problem here is that both data and num_components are unsigned int. This means if the user provides a big enough value for the first check, we can overflow the calculation:
If, for example we set data as 0xffffffff, and then num_components as a small value, the calculation will overflow and the result can be less than len. Then when we pass this check, we add data to our buf pointer. In this case, sz will now be pointing to unmapped memory owing to the addition of 0xffffffff, and will cause a segfault when we try to dereference to check for null bytes.
To mitigate this, perhaps you could add a small check before [1] to ensure it doesnt overflow.
Note that this doesnt have to be a segfault. With smaller values, this will alow us to read out of bounds on the heap, reading contents from other chunks and copying them into value.
Thanks for your time.
The text was updated successfully, but these errors were encountered:
Hey
Inside
parseString
, the argumentsdata
, andnum_components
are entirely user controlled. They are added together withbase
and used to check if we can safely read the contents of our string inside our givenlen
. The problem here is that bothdata
andnum_components
areunsigned int
. This means if the user provides a big enough value for the first check, we can overflow the calculation:If, for example we set
data
as0xffffffff
, and thennum_components
as a small value, the calculation will overflow and the result can be less thanlen
. Then when we pass this check, we adddata
to ourbuf
pointer. In this case,sz
will now be pointing to unmapped memory owing to the addition of0xffffffff
, and will cause a segfault when we try to dereference to check for null bytes.To mitigate this, perhaps you could add a small check before
[1]
to ensure it doesnt overflow.Note that this doesnt have to be a segfault. With smaller values, this will alow us to read out of bounds on the heap, reading contents from other chunks and copying them into
value
.Thanks for your time.
The text was updated successfully, but these errors were encountered: