Skip to content

[ZEPPELIN-6190] Prevent directory escape bypass through repeated URL decoding #4891

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

Merged
merged 2 commits into from
Jun 3, 2025

Conversation

tbonelee
Copy link
Contributor

@tbonelee tbonelee commented Nov 3, 2024

What is this PR for?

This PR addresses an issue in NotebookService where the notebook path validation only performs a single decoding pass.
This allowed a malicious user to bypass validation by double-encoding the ".." token.
By implementing the repeated decoding, we can prevent this bypass.
Additionally, to prevent excessive decoding attempts, a maximum limit on the number of decoding attempts has been added.

What type of PR is it?

Hot Fix

What is the Jira issue?

https://issues.apache.org/jira/projects/ZEPPELIN/issues/ZEPPELIN-6190

How should this be tested?

  • CI

Questions:

  • Does the license files need to update? No
  • Is there breaking changes for older versions?
    • There may be minor compatibility issues if a user relies on multiple encoded paths, but this is unlikely in realistic scenarios.
  • Does this needs documentation? No

@tbonelee
Copy link
Contributor Author

tbonelee commented Nov 3, 2024

cc @jongyoul

@tbonelee
Copy link
Contributor Author

@pan3793 @Reamer
When you have a moment, could you check this PR? Appreciate it!

Copy link
Contributor

@Reamer Reamer left a comment

Choose a reason for hiding this comment

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

Just a few minor comments. The five attempts seem quite random. But I think it's good that an error message is thrown afterwards.

@tbonelee
Copy link
Contributor Author

@Reamer Thank you for the feedback! I've added a commit based on your feedback.

I agree that using five attempts feels somewhat arbitrary. However I couldn't think of a better alternative, so I went with this value.
If you have any other suggestions, I'd love to hear them!

@tbonelee tbonelee requested a review from Reamer November 24, 2024 12:18
Copy link
Contributor

@Reamer Reamer left a comment

Choose a reason for hiding this comment

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

LGTM, let's wait for CI

@pan3793
Copy link
Member

pan3793 commented Nov 25, 2024

I read the change and understand what it does, but I don't understand why should this change.
And please create a JIRA ticket for it, if you think this involves CVE which is not suitable to discuss publicly, you can write a detailed message to [email protected]

@Reamer
Copy link
Contributor

Reamer commented Nov 28, 2024

I agree with @pan3793 . Please create a Jira ticket and adjust the pull request description accordingly.

@tbonelee tbonelee changed the title [NO-ISSUE] Prevent directory escape bypass through repeated URL decoding [ZEPPELIN-6190] Prevent directory escape bypass through repeated URL decoding May 16, 2025
@tbonelee
Copy link
Contributor Author

For context: this PR was based on a security issue I received from @jongyoul, but I didn't have a Jira ticket at the time, which may have caused some confusion.

Apologies for the earlier lack of clarity - I've now created ZEPPELIN-6190 and linked this PR to it.

@jongyoul
Copy link
Member

@tbonelee Thank you for sharing it.

@pan3793 @Reamer I missed sharing context with others as well. Sorry. This change relates to the security issue, so I thought it would be good to omit creating a ticket. Feel free to reach me if something is not clear. 🙏

@Reamer Reamer merged commit 588b54b into apache:master Jun 3, 2025
17 checks passed
asf-gitbox-commits pushed a commit that referenced this pull request Jun 3, 2025
…decoding

### What is this PR for?
This PR addresses an issue in `NotebookService` where the notebook path validation only performs a single decoding pass.
This allowed a malicious user to bypass validation by double-encoding the `".."` token.
By implementing the repeated decoding, we can prevent this bypass.
Additionally, to prevent excessive decoding attempts, a maximum limit on the number of decoding attempts has been added.

### What type of PR is it?
Hot Fix

### What is the Jira issue?
https://issues.apache.org/jira/projects/ZEPPELIN/issues/ZEPPELIN-6190

### How should this be tested?
* CI

### Questions:
* Does the license files need to update? No
* Is there breaking changes for older versions?
  * There may be minor compatibility issues if a user relies on multiple encoded paths, but this is unlikely in realistic scenarios.
* Does this needs documentation? No


Closes #4891 from tbonelee/fix-validating-note-path.

Signed-off-by: Philipp Dallig <[email protected]>
@Reamer
Copy link
Contributor

Reamer commented Jun 3, 2025

Merged into master and branch-0.12

@tbonelee tbonelee deleted the fix-validating-note-path branch June 3, 2025 13:15
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.

4 participants