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

lib: updatehub: Improve security #24154

Merged
merged 3 commits into from
Apr 17, 2020

Conversation

nandojve
Copy link
Member

@nandojve nandojve commented Apr 7, 2020

There are some issues related to security on UpdateHub and this address the following fixes:

  • Fix variable-size string copy
  • Switch from snprintk in favor of bin2hex
  • Remove all heap allocations and update stacks sizes
  • Improvemenets on probe security

Fixes #24212

Copy link
Collaborator

@d3zd3z d3zd3z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't mention CVE or ZEPSEC numbers in the commit text.

@nandojve
Copy link
Member Author

nandojve commented Apr 8, 2020

Please don't mention CVE or ZEPSEC numbers in the commit text.

Done! Could delete msg.

lib/updatehub/updatehub.c Outdated Show resolved Hide resolved
lib/updatehub/updatehub.c Outdated Show resolved Hide resolved
lib/updatehub/updatehub.c Outdated Show resolved Hide resolved
lib/updatehub/updatehub.c Outdated Show resolved Hide resolved
A malformed JSON payload that is received from an UpdateHub server
may trigger memory corruption in the Zephyr OS. This could result
in a denial of service in the best case, or code execution in the
worst case.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
@nandojve nandojve force-pushed the topic/zepsec-28 branch 2 times, most recently from cba58f0 to db2914c Compare April 15, 2020 22:17
@nandojve
Copy link
Member Author

We decide postpone SLAB right now and focus on fix the security issues first. The SLAB solution will be added with other improvements soon. For us, decrease the memory footprint is a requirement to allow use of UpdateHub over BLE and IEEE 802.15.4.

@zephyrbot
Copy link
Collaborator

zephyrbot commented Apr 16, 2020

All checks are passing now.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

Use bin2hex instead inline conversion.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Improve buffer overflow security on probe_cb. This ensures that socket
buffer have fixed lenght and content received by COAP fills properly on
metadata buffer. After that, ensures that metadata content is a valid
string with length lower than metadata size.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
@jukkar jukkar merged commit 894dcbb into zephyrproject-rtos:master Apr 17, 2020
@nandojve nandojve deleted the topic/zepsec-28 branch April 17, 2020 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lib: updatehub: Improve memory footprint
6 participants