Security context
MediumGHSA-9vg9-x38g-9hfx CVE-2014-2064CWE-200Published May 17, 2022

Jenkins allows attackers to determine whether a user exists

Research this vulnerability

Research is free — Hunters explains how the bug works, the root-cause code pattern, how the fix addresses it, and how to test whether a target is affected, in chat. Investigate & write exploit is a paid run — the engine reads the advisory and fix commits, then builds and validates a working proof-of-concept exploit with reproduction steps.

Affected versions

1.533 → fixed in 1.5510 → fixed in 1.532.2

Details

The loadUserByUsername function in hudson/security/HudsonPrivateSecurityRealm.java in Jenkins before 1.551 and LTS before 1.532.2 allows remote attackers to determine whether a user exists via vectors related to failed login attempts.

The fix

[FIXED SECURITY-79] Prevent (private security realm)

Jesse Glick· Feb 7, 2014, 08:18 PM+112fbf9673447
core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java+11 2
@@ -78,6 +78,8 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -173,8 +175,15 @@ public Details loadUserByUsername(String username) throws UsernameNotFoundExcept
@Override
protected Details authenticate(String username, String password) throws AuthenticationException {
Details u = loadUserByUsername(username);
- if (!u.isPasswordCorrect(password))
- throw new BadCredentialsException("Failed to login as "+username);
+ if (!u.isPasswordCorrect(password)) {
+ String message;
+ try {
+ message = ResourceBundle.getBundle("org.acegisecurity.messages").getString("AbstractUserDetailsAuthenticationProvider.badCredentials");
+ } catch (MissingResourceException x) {
+ message = "Bad credentials";
+ }
+ throw new BadCredentialsException(message);
+ }
return u;
}

References