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

Fish 9690 filtering incorrect characters from header rfc 9110 #39

Conversation

breakponchito
Copy link

@breakponchito breakponchito commented Nov 12, 2024

This is a PR to include new properties on the grizzly implementation to enable Header Name and Header Value validation against invalid characters mentioned on the RFC-9110, here the reference of the reported issue: Glassfish issue and here the reserved CVE CVE-2024-45687

To test this set the dependency version on the payara server: 4.0.2.payara-p2 build and run
deploy the following reproducer:
ReproducerJDK11.zip

after starting the server set the following properties on the Payara configuration. You can do it by console ui, command line or directly on the domain.xml file:

  • -Dorg.glassfish.grizzly.http.STRICT_HEADER_NAME_VALIDATION_RFC_9110=true
  • -Dorg.glassfish.grizzly.http.STRICT_HEADER_VALUE_VALIDATION_RFC_9110=true

image

image

asadmin create-jvm-options --target=server-config "-Dorg.glassfish.grizzly.http.STRICT_HEADER_NAME_VALIDATION_RFC_9110\=true"

asadmin create-jvm-options --target=server-config "-Dorg.glassfish.grizzly.http.STRICT_HEADER_VALUE_VALIDATION_RFC_9110\=true"

after adding the properties you need to restart the server

by default on the grizzly side those properties are set as false

deploy the reproducer and make curl calls

Header Name Validation tests:

the result of any of those test should be error 400:
image

this will return status 200 but the header will be discarted because of the \0 character

image

Header Value Validations tests:

In the case of header validation we can't be very strict on the validation that is why the \n is permitted an is evaluated as a new line on the content for the header value and the \0 is immediately not processed from curl because by default we can't consider that character on the request headers and the \r character can be included as a character on the header values and this will be rejected

JamesHillyard and others added 30 commits October 28, 2021 15:34
FISH-376 Allow finer configuration details of HTTP GZIP compression
…nfiguration

Finer configuration of GZIP Compression
as java8 is a compile time requirement, the checks for jvm version
before java7 makes no sense anymore.

Remove unused JdkVersion class.

Signed-off-by: Tigran Mkrtchyan <[email protected]>
This fixes temporary file information disclosure vulnerability due to the use
of the vulnerable `File.createTempFile()` method. The vulnerability is fixed by
using the `Files.createTempFile()` method which sets the correct posix permissions.

Weakness: CWE-377: Insecure Temporary File
Severity: Medium
CVSSS: 5.5
Detection: CodeQL & OpenRewrite (https://public.moderne.io/recipes/org.openrewrite.java.security.SecureTempFileCreation)

Reported-by: Jonathan Leitschuh <[email protected]>
Signed-off-by: Jonathan Leitschuh <[email protected]>

Bug-tracker: JLLeitschuh/security-research#18


Co-authored-by: Moderne <[email protected]>
the rest of the code uses java.util.concurrent.ThreadLocalRandom.
Thus no reasons tho have a private unused copy ot it.
The NullaryFunction has an equivalent in standard java API. So, lets use
it.
Fixes eclipse-ee4j#2122 - Manifests should contain automatic module names
SSLParameters is a class introduced in java6 which can take over
SSLEngineConfigurator. As a first step, let allow applications to
use SSLParameters to configure SSLEngineConfigurator. Update
SSLEngineConfigurator to use it internally instead of bunch
of class fields.

Signed-off-by: Tigran Mkrtchyan <[email protected]>
utils: remove unused version of ThreadLocalRandom
ssl: introduce SSLEngineConfigurator#setSSLParameters
src: drop NullaryFunction in favor or java.util.Supplier
…tV2/fix/JLL/temporary_file_local_information_disclosure

[SECURITY] Fix Temporary File Information Disclosure Vulnerability
SpotBugs analysis: Holder.toString() may return null eclipse-ee4j#2182
Signed-off-by: Arjan Tijms <[email protected]>
Update versions in poms and adjust pom where needed for that
This way subclasses making use of this ctor can set parameters without
getting NPE.

Signed-off-by: Arjan Tijms <[email protected]>
Create empty SSL parameters in protected ctor
Signed-off-by: Arjan Tijms <[email protected]>
The commit cb5fdde have dropped NullaryFunction in favor or java.util.Supplier,
however, the deprecation annotation was not removed.

fixes: eclipse-ee4j#2196

Signed-off-by: Tigran Mkrtchyan <[email protected]>
Fixes eclipse-ee4j#2192 - Grizzly 2.4.4/4.0.0 missing Content-Type in response
src: remove unintended deprecation annotation
Pandrex247 and others added 3 commits December 9, 2024 13:01
…aracters-from-header-rfc-9110' into FISH-9690-filtering-incorrect-characters-from-header-rfc-9110
@breakponchito breakponchito changed the base branch from 4.0.0.payara-maintenance to 4.0.2.payara-maintenance December 9, 2024 22:09
…tenance' into FISH-9690-filtering-incorrect-characters-from-header-rfc-9110

# Conflicts:
#	boms/bom/pom.xml
#	extras/bundles/grizzly-httpservice-bundle/pom.xml
#	extras/bundles/pom.xml
#	extras/connection-pool/pom.xml
#	extras/grizzly-httpservice/pom.xml
#	extras/http-server-jaxws/pom.xml
#	extras/http-server-multipart/pom.xml
#	extras/http-servlet-extras/pom.xml
#	extras/pom.xml
#	extras/tls-sni/pom.xml
#	modules/bundles/comet/pom.xml
#	modules/bundles/core/pom.xml
#	modules/bundles/http-all/pom.xml
#	modules/bundles/http-servlet/pom.xml
#	modules/bundles/http/pom.xml
#	modules/bundles/pom.xml
#	modules/bundles/websockets/pom.xml
#	modules/comet/pom.xml
#	modules/comet/src/main/java/module-info.java
#	modules/grizzly/pom.xml
#	modules/grizzly/src/main/java/org/glassfish/grizzly/compression/zip/GZipEncoder.java
#	modules/http-ajp/pom.xml
#	modules/http-server/pom.xml
#	modules/http-servlet/pom.xml
#	modules/http/pom.xml
#	modules/http2/pom.xml
#	modules/monitoring/grizzly/pom.xml
#	modules/monitoring/http-server/pom.xml
#	modules/monitoring/http/pom.xml
#	modules/monitoring/pom.xml
#	modules/pom.xml
#	modules/portunif/pom.xml
#	modules/websockets/pom.xml
#	pom.xml
#	samples/connection-pool-samples/pom.xml
#	samples/framework-samples/pom.xml
#	samples/http-ajp-samples/pom.xml
#	samples/http-jaxws-samples/pom.xml
#	samples/http-multipart-samples/pom.xml
#	samples/http-samples/pom.xml
#	samples/http-server-samples/pom.xml
#	samples/pom.xml
#	samples/portunif/pom.xml
#	samples/tls-sni-samples/pom.xml
@breakponchito breakponchito changed the base branch from 4.0.2.payara-maintenance to 4.0.0.payara-maintenance December 10, 2024 14:54
@Pandrex247 Pandrex247 self-requested a review December 11, 2024 16:55
@Pandrex247 Pandrex247 dismissed their stale review December 11, 2024 16:56

Changes made

Pandrex247 and others added 17 commits December 11, 2024 11:11
Signed-off-by: Andrew Pielage <[email protected]>
FISH-376 Allow finer configuration details of HTTP GZIP compression
as java8 is a compile time requirement, the checks for jvm version
before java7 makes no sense anymore.

Remove unused JdkVersion class.

Signed-off-by: Tigran Mkrtchyan <[email protected]>
the rest of the code uses java.util.concurrent.ThreadLocalRandom.
Thus no reasons tho have a private unused copy ot it.
SSLParameters is a class introduced in java6 which can take over
SSLEngineConfigurator. As a first step, let allow applications to
use SSLParameters to configure SSLEngineConfigurator. Update
SSLEngineConfigurator to use it internally instead of bunch
of class fields.

Signed-off-by: Tigran Mkrtchyan <[email protected]>
The NullaryFunction has an equivalent in standard java API. So, lets use
it.
This fixes temporary file information disclosure vulnerability due to the use
of the vulnerable `File.createTempFile()` method. The vulnerability is fixed by
using the `Files.createTempFile()` method which sets the correct posix permissions.

Weakness: CWE-377: Insecure Temporary File
Severity: Medium
CVSSS: 5.5
Detection: CodeQL & OpenRewrite (https://public.moderne.io/recipes/org.openrewrite.java.security.SecureTempFileCreation)

Reported-by: Jonathan Leitschuh <[email protected]>
Signed-off-by: Jonathan Leitschuh <[email protected]>

Bug-tracker: JLLeitschuh/security-research#18


Co-authored-by: Moderne <[email protected]>
This way subclasses making use of this ctor can set parameters without
getting NPE.

Signed-off-by: Arjan Tijms <[email protected]>
Signed-off-by: Arjan Tijms <[email protected]>
The commit cb5fdde have dropped NullaryFunction in favor or java.util.Supplier,
however, the deprecation annotation was not removed.

fixes: eclipse-ee4j#2196

Signed-off-by: Tigran Mkrtchyan <[email protected]>
Copy link
Member

@Pandrex247 Pandrex247 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rebasing onto 4.0.0 without all of the 4.0.2 commits

…aracters-from-header-rfc-9110' into FISH-9690-filtering-incorrect-characters-from-header-rfc-9110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.