OVAL/XCCDF/DS/source: fix memory-corruption bugs on malformed input#2363
Open
edznux-dd wants to merge 1 commit into
Open
OVAL/XCCDF/DS/source: fix memory-corruption bugs on malformed input#2363edznux-dd wants to merge 1 commit into
edznux-dd wants to merge 1 commit into
Conversation
- OVAL oval_set.c: a <set> mixing a nested <set> (aggregate) with
object_reference/filter children (collective) wrote into the wrong union
member, so oval_setobject_free() later freed a model-owned object
(use-after-free / double free). Reject children that don't match the
established set type.
- XCCDF resolve.c: <warning> entries were resolved through
xccdf_resolve_textlist(), which reads each item as oscap_text -- but a
xccdf_warning is smaller, so this read out of bounds (heap-buffer-overflow).
Added a dedicated xccdf_resolve_warninglist() operating on warning->text.
- DS sds.c: component_id aliased the xlink_href buffer that was freed too
early (use-after-free); keep it alive until last use. Also cap catalog
component-ref recursion (cyclic catalog -> OOM); this recursion-DoS fix is
bundled here because it is interleaved with the UAF fix in the same function.
Also a NULL id guard in lookup_component_in_collection.
- source/schematron.c: OSCAP_SCHEMATRON_TABLE lacked the {0,NULL,NULL}
sentinel its lookup loop relies on -> global-buffer-overflow; added it.
Plus NULL guards for missing href/uri, empty <catalog>, and NULL XPath eval.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



(see #2361 for more context)
This is the 3rd PR of the series (out of 4). This one focuses on UaF, double free and heap buffer overflow found with the fuzzer setup (under address sanitizer for ease of discovery)
Open question:
I've set
#define DS_SDS_MAX_COMPONENT_REF_DEPTHto an arbitrary limit of30, but I'm not familiar enough withopenscapexpectations here to see if this could/should be lowered. 30 was a safe, but conservative value (I don't see a real scenario where it would be > 5, but I might be completely miss guided here)For more context: