[Backport branch-8-6] Fix WCS 2.0 GetCoverage DoS from non-positive RESOLUTION (GHSA-6jr5-rc9c-p3cj) - #7589
Merged
Merged
Conversation
…c9c-p3cj) An unauthenticated, remotely reachable denial-of-service vulnerability exists in MapServer's WCS 2.0 GetCoverage path. The parser accepts any RESOLUTION value that parses as a double — including negative, zero, and nan — without a > 0 / finiteness check. The resulting negative image dimensions are then cast to size_t (huge value) inside msSmallMalloc()/msSmallCalloc(). Allocation fails, and MapServer's "safe" allocator terminates the process via exit(1). A single crafted request kills the handling CGI/FastCGI worker. Fix: 1. msWCSParseResolutionString20(): After parsing, reject non-finite values and values <= 0 with InvalidParameterValue. This mirrors the existing validation in msWCSParseScaleString20() which already rejects scale <= 0. 2. msWCSGetCoverage20(): Add a defensive guard that rejects width <= 0 or height <= 0 before the existing MAXSIZE check. This catches any edge case where a non-positive dimension reaches this point. Tests added in msautotest/wxs/wcs_simple.map: - Negative RESOLUTION → InvalidParameterValue (was exit(1)) - Zero RESOLUTION → InvalidParameterValue (was raw alloc error)
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.
Backport #7575
Authored by: @sdjasj