Fix Kseaf Derived From Empty Array on DecodeString() Error #6
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.
Hello, I am Virgil, a security researcher from the WSPR (Wolfpack Security and Privacy Research) lab at North Carolina State University.
As part of an ongoing 5G security project, we have done some error handling analysis of free5GC. One finding involves the handling of an error during
hex.DecodeString(Kausf)
oninternal/sbi/producer/ue_authentication.go:175
(Original Line number, updated is 180). An error in this function call results inKseaf
being derived from an empty array. This results in a predictable Kseaf value, assuming the adversary knows the snName.As a Proof-of-Concept, the following code snippet gives me the KSeaf value of
[247 217 81 106 50 180 143 142 179 223 202 133 114 120 163 233 145 78 75 224 236 231 212 69 118 151 63 5 140 250 18 15]
on multiple machines:The code already contained
// TODO: return ProblemDetails
comments. This PR adds these ProblemDetails returns, as well as the problemDetails returns for theconcat
decode (Line 162) and KseafGetKDFValue
(Line 182, 192 in changed).Will open submodule hash update PR on main repo if accepted.