Skip to content

NULL pointer dereference in AMF XML parser (metadata tag without type attribute) #5117

Open

Description

@eldstal

Summary

A crafted AMF XML document can cause a crash due to a NULL pointer dereference during parsing.

Vulnerable versions

Step to reproduce

  1. Create the proof-of-concept OBJ file (nullptr_amf_metadata.amf.xml):
<amf unit="millimeter">
	<object id="0">
		<metadata>dummy</metadata>
	</object>
</amf>
  1. Execute slic3r --info nullptr_amf_metadata.amf.xml
  2. Observe segmentation fault.

Example file

nullptr_amf_metadata.amf.xml.zip

Cause

An attempt is made to read the type attribute of the <metadata> tag, at AMF.cpp:189. The PoC contains a metadata tag without a type attribute.

get_attribute() returns NULL, and thus the creation of the std::string m_value[0] crashes.

Impact

Denial of Service.

Proposed mitigation

Check for NULL before trying to construct the std::string, set a default value or reject the tag. Similar checks are already in place at line 163 and others.

Activity

  1. eldstal commented on Jan 25, 2022

    @eldstal
    Author

    This vulnerability has been assigned CVE-2021-45846.

  2. supermerill commented on Feb 1, 2022

    @supermerill
    Collaborator

    note that patch should also be applied to prusaslicer @bubnikv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions