openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

Security vulnerability in oData Batch Requests due to superfluous linebreak

Open FiddleBe opened this issue 7 years ago • 7 comments

OpenUI5 version: All

Browser/version (+device/version): N/A

We have been informed by our security department that the "F5 BIG-IP ASM attack prevention" module recognizes double linebreaks between a batch request header and a batch-request body as a threat. (split header - cache poisoning)

example: image

Apparently, this can be used to inject malicious code into the cache. (don't ask me how)

I've tracked this down to the dataJs module, where the "writeBatchDelimiter" method adds a superfluous linebreak before the boundary delimiter: image

Which is quite annoying, since this happens on any odata Batch call, both in custom apps as in standard apps, and the F5 module simply blocks those calls, essentially making the launchpad useless from every network path that passes by that threat detection module.

FiddleBe avatar Jun 26 '19 06:06 FiddleBe

Experts are notified via #1970286123

stephania87 avatar Jun 26 '19 11:06 stephania87

Hi @FiddleBe

according to the augmented Backus-Naur form for a multipart message everything seems to be specification conform and correct. Gateway is the same opinion, leaving a CLRF would result in a wrong/ deformed syntax.

Also the rfc states the following:

 generic-message = start-line
                      *(message-header CRLF)
                      CRLF
                      [ message-body ]

I think the F5 BIG-IP ASM attack prevention module is not handling this correctly,

BR Dominik

domianer avatar Jul 04 '19 13:07 domianer

Hi Dominik,

Thanks for your response. I have forwarded your feedback to our security team. But based on the Spec included in your feedback, how do you explain we have 2 empty lines in the request. (notice we don't have a body payload)

image

It looks to me like the datajs goes:

generic-message = **CRLF** start-line
                      *(message-header CRLF)
                      CRLF
                      [ message-body ]

Which is why I think that the first CRLF is too much, or at least it's added at the wrong location and in the wrong conditions. Maybe it should be added after the body injection, on the condition that there is actual body content.

Cheers,

Tom

FiddleBe avatar Jul 04 '19 13:07 FiddleBe

The spec 1521 (for inner requests contained in a batch) says:

NOTE: The CRLF preceding the encapsulation line is conceptually attached to the boundary so that it is possible to have a part that does not end with a CRLF (line break). Body parts that must be considered to end with line breaks, therefore, must have two CRLFs preceding the encapsulation line, the first of which is part of the preceding body part, and the second of which is part of the encapsulation boundary.

This means the last CRLF is belonging to the boundary and not to the body itself. So there is a generic CRLF after all the HTTP header definitions, and one belonging to the boundary. This would result in two CRLFs in case the body message itself is missing.

domianer avatar Jul 04 '19 14:07 domianer

That might indeed indicate that the F5 module doesn't handle this correctly, or is overly paranoid. I'll await feedback from our Security department. I'll keep this updated.

FiddleBe avatar Jul 04 '19 14:07 FiddleBe

Okay, great, thank you @FiddleBe for your patience!

domianer avatar Jul 04 '19 14:07 domianer

Since this discussions seems closed and there is no updates than more that 1 year I'm closing the issue.

Shtilianova avatar Aug 20 '20 13:08 Shtilianova