Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

JS: Web Cache Deception Express #15180

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
Loading
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add missing files
  • Loading branch information
krakendio committed Dec 20, 2023
commit c830a0475b77ae202a19b188de88adba739bfa9e
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @name Web Cache Deception in Express
* @description A caching system has been detected on the application and is vulnerable to web cache deception. By manipulating the URL it is possible to force the application to cache pages that are only accessible by an authenticated user. Once cached, these pages can be accessed by an unauthenticated user.
* @kind problem
* @problem.severity error
* @security-severity 9
* @precision medium
* @id js/web-cache-deception-express
* @tags javascript
* cwe-525
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* cwe-525
* external/cwe/cwe-525

* bug
*/

import javascript
import WebCacheDeceptionLib

from WebCacheDeception::Sink httpHandleFuncCall
where httpHandleFuncCall.toString().matches("%*%")
select httpHandleFuncCall, httpHandleFuncCall + " is used as wildcard endpoint."

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import javascript
import StringOps

module WebCacheDeception {
abstract class Sink extends DataFlow::Node { }

private class Express extends Sink {
Express() {
exists(Import is | is.getImportedModuleNode().getASuccessor().toString() = "express") and
exists(DataFlow::CallNode m |
m.getAMethodCall().getArgument(0).getStringValue().matches("%*") and
this = m.getAMethodCall().getArgument(0)
)
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.