Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request from patched fixes 4 issues.
Fixed potential path traversal vulnerability in FileUploader servlet.
The original code was using a user-controlled variable (filePart.getSubmittedFileName()) to construct the target file path. This could have allowed an attacker to traverse outside of the intended directory by using '../' in the file name. The fix is to use the File class's getParentFile() method to ensure that the file path is within the intended directory.Fixed XSS vulnerability by encoding user input for HTML attributes
The vulnerable code was using PrintWriter to directly print user input into an HTML page without proper encoding. This allowed for potential XSS attacks. The fix encodes all HTML attributes to prevent such attacks.Fixed potential HTTP response splitting vulnerability
Addedresponse.setCharacterEncoding("UTF-8");
to prevent HTTP response splitting attacks.File changed: src/main/java/io/shiftleft/tarpit/ServletTarPit.java
Fixed multiple vulnerabilities in ServletTarPit servlet
This commit fixes several vulnerabilities found in the ServletTarPit servlet:Code injection using ScriptEngine.eval() has been removed to prevent code injection attacks.
The use of user-controlled data in SQL queries has been fixed by parameterizing the SQL queries using prepared statements.
The AES cipher has been updated to use CBC/PKCS7Padding to prevent cryptographic attacks.
Default session middleware settings have been updated to ensure secure cookies.
The 'HttpOnly' flag has been set for cookies to prevent client-side script access.
The 'secure' flag has been set for cookies to prevent transmission over insecure channels.