Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The CBOR library is sensitive to a DOS attack #119

Open
vivekidem opened this issue Sep 7, 2021 · 2 comments
Open

The CBOR library is sensitive to a DOS attack #119

vivekidem opened this issue Sep 7, 2021 · 2 comments
Assignees
Labels
enhancement security Pull requests that address a security vulnerability Waiting for answer

Comments

@vivekidem
Copy link

Hi Team,

According a specially crafted message, the library will try to allocate a message that is way above the memory capacity.

For a CBOR array input. The code was trying to decode the CBOR array before trying to use the byte[]. The library that has no limit on the allocation memory that is requires -> an attacker could get craft a packet that will ask the library to allocate an object that will exceed the available memory.

@c-rack
Copy link
Owner

c-rack commented May 25, 2022

@vivekidem Would you like to make a PR that fixes this?

@c-rack c-rack added enhancement security Pull requests that address a security vulnerability Waiting for answer labels May 25, 2022
@c-rack c-rack assigned c-rack and vivekidem and unassigned c-rack May 25, 2022
@vinaymjoshi
Copy link

@c-rack , from client side it can be mitigated by setting a definite value in setMaxPreallocationSize :

try { val decoder = CborDecoder(ByteArrayInputStream(this)) decoder.setMaxPreallocationSize(1024) return decoder.decode() } catch (e: CborException) { throw UnexpectedEndOfStream(message = "Invalid CBOR Encoded data ") }

However if client side above config is not set, then there should be some default value from library side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement security Pull requests that address a security vulnerability Waiting for answer
Projects
None yet
Development

No branches or pull requests

3 participants