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

Security: Out of bounds read in OBJ face parser #5115

Open
eldstal opened this issue Dec 26, 2021 · 1 comment
Open

Security: Out of bounds read in OBJ face parser #5115

eldstal opened this issue Dec 26, 2021 · 1 comment

Comments

@eldstal
Copy link

eldstal commented Dec 26, 2021

Summary

An out-of-bounds read in the OBJ file parsing leads to segmentation fault and potential information disclosure.

Vulnerable versions

Step to reproduce

  1. Create the proof-of-concept OBJ file (oob_face.obj):
f 1 1 1
  1. Execute slic3r --info oob_face.obj
  2. Observe segmentation fault.

Screenshot

image

Example file

oob_face.zip

Cause

The f (face) element in an OBJ file refers to previously specified vertices by index. A bounds check is missing, allowing a face to be created with invalid vertex indices. This leads to an out of bounds read at TriangleMesh.cpp:59 due to points being a NULL pointer. As the offset is controlled by the input file, this can be leveraged to read a value from an arbitrary location in memory.

Impact

Information disclosure. This type of bug can be used to bypass automatic security mechanisms such as stack protectors and pointer encryption.

Proposed mitigation

It appears that the tinyobj parser has identified that the vertex indices are invalid, so all that's missing is a check before calling the TriangleMesh constructor at IO.cpp:146.

System information

  • OS: Linux
  • Version: Latest GIT (commit b1a5500)
eldstal added a commit to eldstal/Slic3r that referenced this issue Dec 26, 2021
@eldstal
Copy link
Author

eldstal commented Dec 26, 2021

The root cause for this appears to be the same as CVE-2020-28590, which is a good 12 months old by now.

eldstal added a commit to eldstal/Slic3r that referenced this issue Dec 26, 2021
eldstal added a commit to eldstal/Slic3r that referenced this issue Dec 26, 2021
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