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

Fix: Added fallback decoding for Base64 encoded strings #211

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Chvalov
Copy link

@Chvalov Chvalov commented May 30, 2024

I encountered an issue where the importWStalker method in the LoggerImport class fails to decode certain Base64 encoded strings due to illegal characters. The error stack trace indicates an IllegalArgumentException is thrown when trying to decode these strings.

java.lang.IllegalArgumentException: Illegal base64 character 2f
	at java.base/java.util.Base64$Decoder.decode0(Base64.java:852)
	at java.base/java.util.Base64$Decoder.decode(Base64.java:570)
	at burp.Ztmx.decode(Unknown Source)
	at burp.Ztmx.decode(Unknown Source)
	at 

To fix this issue, I implemented a two-step decoding process:
First, attempt to decode using standard Base64.
If standard Base64 decoding fails, catch the IllegalArgumentException and attempt to decode using URL-safe Base64.
This approach ensures that both standard and URL-safe Base64 encoded strings are correctly processed.

This change addresses the issue where some Base64 encoded strings were causing decoding failures due to illegal characters.

- Updated `importWStalker` method to handle both standard and URL-safe Base64 encoded strings.
- Standard Base64 decoding is attempted first, with a fallback to URL-safe decoding if an IllegalArgumentException is thrown.

This change addresses the issue where some Base64 encoded strings were causing decoding failures due to illegal characters.
@Chvalov
Copy link
Author

Chvalov commented May 30, 2024

This fix was already provided earlier 19aefdf, it's strange that the current version contains the problematic code 🤔

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.

1 participant