Skip to content

fix: CWE-434 in src/main/java/org/cysecurity/cspf/jvl/controller/AddPage.java - #35

Open
sudhakarkr wants to merge 1 commit into
masterfrom
fix/cwe-434-66f7bbe3
Open

fix: CWE-434 in src/main/java/org/cysecurity/cspf/jvl/controller/AddPage.java#35
sudhakarkr wants to merge 1 commit into
masterfrom
fix/cwe-434-66f7bbe3

Conversation

@sudhakarkr

Copy link
Copy Markdown
Owner

Automated code fix — CWE-434

File: src/main/java/org/cysecurity/cspf/jvl/controller/AddPage.java
Severity: critical
Lane: code-fix
Skill used: default-secure-coding

Assessment

  • Exploitability: Any remote client can POST filename=shell.jsp and arbitrary content to write a JSP web shell into the servlet's /pages directory and execute it.
  • Confidence: 0.98

Rationale

Restricts the user-supplied filename with a strict allowlist regex (alphanumerics, underscore, dash; max 64 chars; extension limited to .txt/.html/.htm) so executable server-side extensions like .jsp cannot be uploaded, blocking the web-shell vector. Additionally canonicalizes the resolved path and verifies its parent equals the intended pages directory, preventing path traversal via encoded separators or crafted names. On any validation failure the servlet fails closed by printing an error and returning early, without opening or creating any file.

Validation

  • Patched file parses and the SAST rule no longer flags this location.

Opened by the vulnerability management platform after human approval.

…age.java

Restricts the user-supplied filename with a strict allowlist regex (alphanumerics, underscore, dash; max 64 chars; extension limited to .txt/.html/.htm) so executable server-side extensions like .jsp cannot be uploaded, blocking the web-shell vector. Additionally canonicalizes the resolved path and verifies its parent equals the intended pages directory, preventing path traversal via encoded separators or crafted names. On any validation failure the servlet fails closed by printing an error and returning early, without opening or creating any file.
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