Skip to content

Commit 178b032

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Java: add query
1 parent c553e31 commit 178b032

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @name HTTP request type unprotected from CSRF
3+
* @description Using an HTTP request type that is not default-protected from CSRF for a
4+
* state-changing action makes the application vulnerable to a Cross-Site
5+
* Request Forgery (CSRF) attack.
6+
* @kind path-problem
7+
* @problem.severity error
8+
* @security-severity 8.8
9+
* @precision low
10+
* @id java/csrf-unprotected-request-type
11+
* @tags security
12+
* external/cwe/cwe-352
13+
*/
14+
15+
import java
16+
import semmle.code.java.security.CsrfUnprotectedRequestTypeQuery
17+
import CallGraph
18+
19+
from PathNode source, PathNode reachable, PathNode callsReachable
20+
where
21+
source.asMethod() instanceof CsrfUnprotectedMethod and
22+
reachable.asMethod() instanceof DatabaseUpdateMethod and
23+
callsReachable.getASuccessor() = reachable and
24+
source.getASuccessor+() = callsReachable
25+
select source.asMethod(), source, callsReachable,
26+
"Potential CSRF vulnerability due to using an HTTP request type which is not default-protected from CSRF for an apparent $@.",
27+
callsReachable, "state-changing action"

0 commit comments

Comments
 (0)