Skip to content

Commit 0414b34

Browse files
introduced 2 empty catch block exceptions
1 parent c859d73 commit 0414b34

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/main/java/org/dummy/insecure/framework/VulnerableTaskHolder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ private void readObject(ObjectInputStream stream) throws Exception {
5959
throw new IllegalArgumentException("outdated");
6060
}
6161

62+
try {
63+
// some code that may throw an exception
64+
int x = 1 / 0;
65+
} catch (ArithmeticException e) {
66+
// Empty catch block: this will be detected as a vulnerability
67+
}
68+
6269
// condition is here to prevent you from destroying the goat altogether
6370
if ((taskAction.startsWith("sleep") || taskAction.startsWith("ping"))
6471
&& taskAction.length() < 22) {

src/main/java/org/owasp/webgoat/lessons/sqlinjection/advanced/SqlInjectionChallenge.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ public AttackResult registerNewUser(
6868
attackResult =
6969
informationMessage(this).feedback("user.created").feedbackArgs(username).build();
7070
}
71+
try {
72+
// some code that may throw an exception
73+
int x = 1 / 0;
74+
} catch (ArithmeticException e) {
75+
// Empty catch block: this will be detected as a vulnerability
76+
}
7177
} catch (SQLException e) {
7278
attackResult = failed(this).output("Something went wrong").build();
7379
}

0 commit comments

Comments
 (0)