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

PICOC Null Pointer Dereference Denial of Service #34

Open
Halcy0nic opened this issue Jun 21, 2022 · 1 comment
Open

PICOC Null Pointer Dereference Denial of Service #34

Halcy0nic opened this issue Jun 21, 2022 · 1 comment

Comments

@Halcy0nic
Copy link

PICOC Suffers from a Denial of Service (CWE476) vulnerability as a result of a Null Pointer Dereference. Any project or library that uses Picoc also suffers from this issue. An example of this would be picoc-js (https://www.npmjs.com/package/picoc-js). As a result PICOC will immediately segfault.

Reproduction Steps

  1. Create a file to be executed by the PICOC interpreter
$ touch vulncode
  1. Add the following code to the file:
printf("Before Crash\n");
**4%;
printf("This code won't execute because of the crash\n");

  1. Execute PICOC against the file:
$ ./picoc -s vulncode
  1. You will receive a segfault and the program will crash. This is a result of a null pointer dereference that is not caught or handled by the interpreter. The vulnerable line of code can be seen below:
**4%;

Solution

Adding a few if statements that verify the pointer is not NULL before usage will solve this problem. You can find more information about this here:

https://owasp.org/www-community/vulnerabilities/Null_Dereference

@Halcy0nic
Copy link
Author

GDB Trace:
gdb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant