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

adding rstRate for CVE-2023-44487 #94

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Network/HTTP2/Arch/Context.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ data Context = Context {
, pingRate :: Rate
, settingsRate :: Rate
, emptyFrameRate :: Rate
, rstRate :: Rate
, mySockAddr :: SockAddr
, peerSockAddr :: SockAddr
}
Expand Down Expand Up @@ -118,6 +119,7 @@ newContext rinfo siz mysa peersa =
<*> newRate
<*> newRate
<*> newRate
<*> newRate
<*> return mysa
<*> return peersa
where
Expand Down
6 changes: 6 additions & 0 deletions Network/HTTP2/Arch/Receiver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ settingsRateLimit = 4
emptyFrameRateLimit :: Int
emptyFrameRateLimit = 4

rstRateLimit :: Int
rstRateLimit = 4

----------------------------------------------------------------

frameReceiver :: Context -> Config -> IO ()
Expand Down Expand Up @@ -449,6 +452,9 @@ stream FrameWindowUpdate header bs _ s strm = do

-- Transition (stream6)
stream FrameRSTStream header@FrameHeader{streamId} bs ctx s strm = do
rate <- getRate $ rstRate ctx
when (rate > rstRateLimit) $
E.throwIO $ ConnectionErrorIsSent ProtocolError streamId "too many rst_stream"
RSTStreamFrame err <- guardIt $ decodeRSTStreamFrame header bs
let cc = Reset err

Expand Down