-
-
Notifications
You must be signed in to change notification settings - Fork 747
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
buffer overflow #1799
Comments
Thanks! However are you sure about this? Can you provide me more detailed info about exactly what line fails? And on an up to date build from Git master? Looking at the code:
|
detection instructionsIn some cases, the overflow will not cause the program to crash. However, it can be found through the tool Address sanitizer(https://github.com/google/sanitizers/wiki/AddressSanitizer) you should add some flags to CFLAGS and DFLAGS in makefile: CFLAGS?=-Wall -Wextra -Wconversion -Werror=implicit-function-declaration -fno-strict-aliasing -g -fsanitize=address compile commandmake test command./espruino poc |
Sorry - if you can reproduce maybe you can fix it or at least point me to the actual line of code and what the variables are all set to. I don't see how this error can occur, I've tested with a normal compile and everything looks spot on. |
Vulnerabilities are generally difficult to discover, otherwise they will not be hidden for so long. If I have the time to help you with specific analysis, under normal compilation options, it really does not go wrong. |
@gfwilliams I have helped you clarify your code and the problems in your code. What's more, I propose a fix. This is a typical off-one-byte overflow. If you do not pay attention, it will lead to remote code execution: https://csl.com.co/en/off-by-one-explained/. This kind of overflow is not easy to cause the program to crash directly. It can be well detected by ASAN. I hope you will pay attention to it. stack overflow processthe smallest poc code
reasonWhen the code execute to src/jsvar.c: 1286
The funcion
When the code execute to 1295(src/jsvar.c), the contents of
In the current situation, How the fixApply for one more byte for buf.
|
Perfect, thanks for this! Looks like a fix is needed in |
I noticed that tiny-js(https://github.com/gfwilliams/tiny-js) was also developed by you, and I also found many problems with it. There are many developers using tiny-js, I hope you can take the time to check it out. |
I did notice that - you filed a lot of issues in it. Are you basing the usage on GitHub stars, or something else? TinyJS was always a bit rough and ready so realistically I didn't think anyone was really using it. |
I am basing the usage on GitHub stars. |
Remove 1-byte padding in Graphics lib
Enviroment
poc:
vulnerability description:
The poc will cause the memory corruption of the parser. Below is the output of ASAN:
The text was updated successfully, but these errors were encountered: