Skip to content

Commit 8272d59

Browse files
JLLeitschuhfelicitymayaibaars
authored
Apply suggestions from code review
#4312 Co-authored-by: Felicity Chapman <felicitymay@github.com> Co-authored-by: Arthur Baars <aibaars@github.com>
1 parent ab3772e commit 8272d59

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

java/ql/src/Security/CWE/CWE-338/JHipsterGeneratedPRNG.qhelp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"qhelp.dtd">
44
<qhelp>
55
<overview>
6-
<p>This query detects instances of <code>RandomUtil.java</code> generated by a <a href="https://www.jhipster.tech/">JHipster</a> version vulnerable to <a href="https://github.com/jhipster/jhipster-kotlin/security/advisories/GHSA-j3rh-8vwq-wh84">CVE-2019-16303</a>.</p>
6+
<p>This query detects instances of <code>RandomUtil.java</code> that were generated by a <a href="https://www.jhipster.tech/">JHipster</a> version that is vulnerable to <a href="https://github.com/jhipster/jhipster-kotlin/security/advisories/GHSA-j3rh-8vwq-wh84">CVE-2019-16303</a>.</p>
77

8-
<p>Using one password reset token from your app combined with the proof of concept (POC) linked below, an attacker can determine all future password reset tokens to be generated by this server.
9-
This allows an attacker to pick and choose what account they would like to takeover by sending account password reset requests for targeted accounts.</p>
8+
<p>If an app uses <code>RandomUtil.java</code> generated by a vulnerable version of JHipster, attackers can request a password reset token and use this to predict the value of future reset tokens generated by this server.
9+
Using this information, they can create a reset link that allows them to take over any account.</p>
1010

1111
<p>This vulnerability has a
1212
<a href="https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?name=CVE-2019-16303&amp;vector=AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H&amp;version=3.1&amp;source=NIST">
@@ -26,24 +26,27 @@ This allows an attacker to pick and choose what account they would like to takeo
2626

2727
<recommendation>
2828

29-
<p>An automated refactoring <a href="https://github.com/openrewrite/rewrite">rewrite</a> module <a href="https://github.com/moderneinc/jhipster-cwe-338"> can be found here</a>.</p>
29+
<p>You should refactor the <code>RandomUtil</code> class and replace every call to <code>RandomStringUtils.randomAlphaNumeric</code>. You could regenerate the class using the latest version of JHipster, or use an automated refactoring. For example, using the <a href="https://github.com/moderneinc/jhipster-cwe-338">Patching JHipster CWE-338</a> for the <a href="https://github.com/openrewrite/rewrite">Rewrite project</a>.
30+
</p>
3031
</recommendation>
3132

3233
<references>
3334

3435
<li>
36+
Cloudflare Blog:
3537
<a href="https://blog.cloudflare.com/why-randomness-matters/">
36-
Cloudflare Blog: Why secure systems require random numbers
38+
Why secure systems require random numbers
3739
</a>
3840
</li>
3941
<li>
42+
Hacker News:
4043
<a href="https://news.ycombinator.com/item?id=639976">
4144
How I Hacked Hacker News (with arc security advisory)
4245
</a>
4346
</li>
4447
<li>
45-
Research (Hacking Apache Commons RandomStringUtils):
46-
<a href="https://web.archive.org/web/20191126104359/https://medium.com/@alex91ar/the-java-soothsayer-a-practical-application-for-insecure-randomness-c67b0cd148cd">
48+
Posts by Pucara Information Security Team:
49+
<a href="https://blog.pucarasec.com/2020/05/09/the-java-soothsayer-a-practical-application-for-insecure-randomness-includes-free-0day/">
4750
The Java Soothsayer: A practical application for insecure randomness. (Includes free 0day)
4851
</a>
4952
</li>

java/ql/src/Security/CWE/CWE-338/JHipsterGeneratedPRNG.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* @name Detect JHipster Generator Vulnnerability CVE-2019-16303
3-
* @description Detector for the CVE-2019-16303 vulnerability that existed in the JHipster code generator.
2+
* @name Detect JHipster Generator Vulnerability CVE-2019-16303
3+
* @description Using a vulnerable version of JHipster to generate random numbers makes it easier for attackers to take over accounts.
44
* @kind problem
55
* @problem.severity error
66
* @precision very-high

java/ql/src/semmle/code/java/frameworks/apache/Lang.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Definitions related to the Apache Commons Lang library. */
1+
/** Definitions related to the Apache Commons Lang library. */
22
import semmle.code.java.Type
33

44
/*--- Types ---*/

0 commit comments

Comments
 (0)