code
stringlengths
12
2.05k
label
int64
0
1
programming_language
stringclasses
9 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
103
description
stringlengths
36
1.23k
url
stringlengths
36
48
label_name
stringclasses
2 values
public void corsNoTags() { InputStream is = getClass().getResourceAsStream("/access-sample1.xml"); PolicyRestrictor restrictor = new PolicyRestrictor(is); assertTrue(restrictor.isOriginAllowed("http://bla.com", false)); assertTrue(restrictor.isOriginAllowed("http://www.jolokia.org", false)); assertTrue(restrictor.isOriginAllowed("https://www.consol.de", false)); }
1
Java
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
public void headerMinusSignContentLengthValidationShouldPropagateWithEndStream() { headerSignContentLengthValidationShouldPropagateWithEndStream(true, true); }
1
Java
CWE-444
Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by those entities that are at the ultimate destination.
https://cwe.mitre.org/data/definitions/444.html
safe
public void testMatchUse() { JWKMatcher matcher = new JWKMatcher.Builder().keyUse(KeyUse.ENCRYPTION).build(); assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1").keyUse(KeyUse.ENCRYPTION).build())); assertFalse(matcher.matches(new ECKey.Builder(ECKey.Curve.P_256, new Base64URL("x"), new Base64URL("y")).keyID("2").build())); assertEquals("use=enc", matcher.toString()); }
0
Java
CWE-347
Improper Verification of Cryptographic Signature
The software does not verify, or incorrectly verifies, the cryptographic signature for data.
https://cwe.mitre.org/data/definitions/347.html
vulnerable
public CsrfTokenHandler(final Form< ? > form) { form.add(csrfTokenField = new HiddenField<String>("csrfToken", Model.of(getCsrfSessionToken()))); }
0
Java
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
protected DocumentReference resolveTemplate(String template) { if (StringUtils.isNotBlank(template)) { DocumentReference templateReference = this.currentmixedReferenceResolver.resolve(template); // Make sure the current user have access to the template document before copying it if (this.autorization.hasAccess(Right.VIEW, templateReference)) { return templateReference; } } return null; }
0
Java
CWE-862
Missing Authorization
The software does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
public JpaOrder nullsNative() { return with(NullHandling.NATIVE); }
1
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
protected String getExecutionPreamble() { if ( getWorkingDirectoryAsString() == null ) { return null; } String dir = getWorkingDirectoryAsString(); StringBuilder sb = new StringBuilder(); sb.append( "cd " ); sb.append( quoteOneItem( dir, false ) ); sb.append( " && " ); return sb.toString(); }
1
Java
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/78.html
safe
protected static void validateNCName(String ncname) { if (!RE_NCNAME.matcher(ncname).matches()) { throw new IllegalArgumentException(String.format("Illegal character in local name: '%s'.", ncname)); } }
1
Java
CWE-91
XML Injection (aka Blind XPath Injection)
The software does not properly neutralize special elements that are used in XML, allowing attackers to modify the syntax, content, or commands of the XML before it is processed by an end system.
https://cwe.mitre.org/data/definitions/91.html
safe
public void headersContentLengthInvalid() throws Exception { headersContentLength(true); }
1
Java
CWE-444
Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by those entities that are at the ultimate destination.
https://cwe.mitre.org/data/definitions/444.html
safe
public RFC5649Wrap() { super(new RFC5649WrapEngine(new AESEngine())); }
1
Java
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
safe
public EfficiencyStatement getUserEfficiencyStatementByResourceKey(Long resourceKey, Identity identity){ StringBuilder sb = new StringBuilder(256); sb.append("select statement from effstatementstandalone as statement") .append(" where statement.identity.key=:identityKey and statement.resourceKey=:resourceKey"); List<UserEfficiencyStatementStandalone> statement = dbInstance.getCurrentEntityManager() .createQuery(sb.toString(), UserEfficiencyStatementStandalone.class) .setParameter("identityKey", identity.getKey()) .setParameter("resourceKey", resourceKey) .getResultList(); if(statement.isEmpty() || statement.get(0).getStatementXml() == null) { return null; } return (EfficiencyStatement)xstream.fromXML(statement.get(0).getStatementXml()); }
0
Java
CWE-91
XML Injection (aka Blind XPath Injection)
The software does not properly neutralize special elements that are used in XML, allowing attackers to modify the syntax, content, or commands of the XML before it is processed by an end system.
https://cwe.mitre.org/data/definitions/91.html
vulnerable
public void addViolation(String propertyName, String message) { violationOccurred = true; String messageTemplate = escapeEl(message); context.buildConstraintViolationWithTemplate(messageTemplate) .addPropertyNode(propertyName) .addConstraintViolation(); }
0
Java
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
RekeyThread() throws GeneralSecurityException { super("Rekey secret thread"); rewriter = new SecretRewriter(new File(getBaseDir(),"backups")); }
1
Java
NVD-CWE-noinfo
null
null
null
safe
public BigInteger calculateAgreement( CipherParameters pubKey) { DHPublicKeyParameters pub = (DHPublicKeyParameters)pubKey; if (!pub.getParameters().equals(dhParams)) { throw new IllegalArgumentException("Diffie-Hellman public key has wrong parameters."); } return pub.getY().modPow(key.getX(), dhParams.getP()); }
0
Java
CWE-320
Key Management Errors
Weaknesses in this category are related to errors in the management of cryptographic keys.
https://cwe.mitre.org/data/definitions/320.html
vulnerable
public void setUp() throws Exception { MockitoAnnotations.initMocks(this); }
1
Java
CWE-502
Deserialization of Untrusted Data
The application deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public static <T extends Descriptor> T find(Collection<? extends T> list, String className) { for (T d : list) { if(d.getClass().getName().equals(className)) return d; } // Since we introduced Descriptor.getId(), it is a preferred method of identifying descriptor by a string. // To make that migration easier without breaking compatibility, let's also match up with the id. for (T d : list) { if(d.getId().equals(className)) return d; } return null; }
0
Java
CWE-264
Permissions, Privileges, and Access Controls
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.
https://cwe.mitre.org/data/definitions/264.html
vulnerable
protected int typeMinimumSize(byte type) { return 1; }
1
Java
CWE-770
Allocation of Resources Without Limits or Throttling
The software allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor.
https://cwe.mitre.org/data/definitions/770.html
safe
public ECKey(final Curve crv, final Base64URL x, final Base64URL y, final Base64URL d, final KeyUse use, final Set<KeyOperation> ops, final Algorithm alg, final String kid, final URI x5u, final Base64URL x5t, final Base64URL x5t256, final List<Base64> x5c, final KeyStore ks) { super(KeyType.EC, use, ops, alg, kid, x5u, x5t, x5t256, x5c, ks); if (crv == null) { throw new IllegalArgumentException("The curve must not be null"); } this.crv = crv; if (x == null) { throw new IllegalArgumentException("The 'x' coordinate must not be null"); } this.x = x; if (y == null) { throw new IllegalArgumentException("The 'y' coordinate must not be null"); } this.y = y; ensurePublicCoordinatesOnCurve(crv, x, y); if (d == null) { throw new IllegalArgumentException("The 'd' coordinate must not be null"); } this.d = d; this.privateKey = null; }
1
Java
CWE-347
Improper Verification of Cryptographic Signature
The software does not verify, or incorrectly verifies, the cryptographic signature for data.
https://cwe.mitre.org/data/definitions/347.html
safe
protected boolean evaluate(InputSource inputSource) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder dbuilder = factory.newDocumentBuilder(); Document doc = dbuilder.parse(inputSource); //An XPath expression could return a true or false value instead of a node. //eval() is a better way to determine the boolean value of the exp. //For compliance with legacy behavior where selecting an empty node returns true, //selectNodeIterator is attempted in case of a failure. CachedXPathAPI cachedXPathAPI = new CachedXPathAPI(); XObject result = cachedXPathAPI.eval(doc, xpath); if (result.bool()) return true; else { NodeIterator iterator = cachedXPathAPI.selectNodeIterator(doc, xpath); return (iterator.nextNode() != null); } } catch (Throwable e) { return false; } }
0
Java
CWE-611
Improper Restriction of XML External Entity Reference
The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.
https://cwe.mitre.org/data/definitions/611.html
vulnerable
public DefaultFileSystemResourceLoader(String path) { this.baseDirPath = Optional.of(Paths.get(normalize(path))); }
0
Java
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
public JpaOrder nullsLast() { return with(NullHandling.NULLS_LAST); }
1
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
safe
public BigInteger calculateAgreement( CipherParameters pubKey) { DHPublicKeyParameters pub = (DHPublicKeyParameters)pubKey; if (!pub.getParameters().equals(dhParams)) { throw new IllegalArgumentException("Diffie-Hellman public key has wrong parameters."); } BigInteger result = pub.getY().modPow(key.getX(), dhParams.getP()); if (result.compareTo(ONE) == 0) { throw new IllegalStateException("Shared key can't be 1"); } return result; }
1
Java
CWE-320
Key Management Errors
Weaknesses in this category are related to errors in the management of cryptographic keys.
https://cwe.mitre.org/data/definitions/320.html
safe
public String accessToken(String username) { Algorithm algorithm = Algorithm.HMAC256(SECRET); return JWT.create() .withExpiresAt(new Date(new Date().getTime() + ACCESS_EXPIRE_TIME)) .withIssuer(ISSUER) .withClaim("username", username) .sign(algorithm); }
0
Java
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
public AccessControlList getAccessControlList(String mediaPackageId) throws NotFoundException, SearchServiceDatabaseException { EntityManager em = null; try { em = emf.createEntityManager(); SearchEntity entity = getSearchEntity(mediaPackageId, em); if (entity == null) { throw new NotFoundException("Could not found media package with ID " + mediaPackageId); } if (entity.getAccessControl() == null) { return null; } else { return AccessControlParser.parseAcl(entity.getAccessControl()); } } catch (NotFoundException e) { throw e; } catch (Exception e) { logger.error("Could not retrieve ACL {}: {}", mediaPackageId, e.getMessage()); throw new SearchServiceDatabaseException(e); } finally { em.close(); } }
0
Java
CWE-863
Incorrect Authorization
The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.
https://cwe.mitre.org/data/definitions/863.html
vulnerable
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { UserFactory.init(); } catch (Throwable e) { throw new ServletException("AddNewUserServlet: Error initialising user factory." + e); } UserManager userFactory = UserFactory.getInstance(); String userID = request.getParameter("userID"); if (userID != null && userID.matches(".*[&<>\"`']+.*")) { throw new ServletException("User ID must not contain any HTML markup."); } String password = request.getParameter("pass1"); boolean hasUser = false; try { hasUser = userFactory.hasUser(userID); } catch (Throwable e) { throw new ServletException("can't determine if user " + userID + " already exists in users.xml.", e); } if (hasUser) { RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher("/admin/userGroupView/users/newUser.jsp?action=redo"); dispatcher.forward(request, response); } else { final Password pass = new Password(); pass.setEncryptedPassword(UserFactory.getInstance().encryptedPassword(password, true)); pass.setSalt(true); final User newUser = new User(); newUser.setUserId(userID); newUser.setPassword(pass); final HttpSession userSession = request.getSession(false); userSession.setAttribute("user.modifyUser.jsp", newUser); // forward the request for proper display RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher("/admin/userGroupView/users/modifyUser.jsp"); dispatcher.forward(request, response); } }
1
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public static DomainSocketAddress newSocketAddress() { try { File file; do { file = PlatformDependent.createTempFile("NETTY", "UDS", null); if (!file.delete()) { throw new IOException("failed to delete: " + file); } } while (file.getAbsolutePath().length() > 128); return new DomainSocketAddress(file); } catch (IOException e) { throw new IllegalStateException(e); } }
1
Java
CWE-379
Creation of Temporary File in Directory with Insecure Permissions
The software creates a temporary file in a directory whose permissions allow unintended actors to determine the file's existence or otherwise access that file.
https://cwe.mitre.org/data/definitions/379.html
safe
public static CharSequence createOptimized(String value) { return io.netty.handler.codec.http.HttpHeaders.newEntity(value); }
0
Java
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
public void testAddAndGetUser() throws Exception { JpaUser user = createUserWithRoles(org1, "user1", "ROLE_ASTRO_101_SPRING_2011_STUDENT"); provider.addUser(user); User loadUser = provider.loadUser("user1"); assertNotNull(loadUser); assertEquals(user.getUsername(), loadUser.getUsername()); assertEquals(PasswordEncoder.encode(user.getPassword(), user.getUsername()), loadUser.getPassword()); assertEquals(user.getOrganization(), loadUser.getOrganization()); assertEquals(user.getRoles(), loadUser.getRoles()); assertNull("Loading 'does not exist' should return null", provider.loadUser("does not exist")); assertNull("Loading 'does not exist' should return null", provider.loadUser("user1", org2.getId())); loadUser = provider.loadUser("user1", org1.getId()); assertNotNull(loadUser); assertEquals(user.getUsername(), loadUser.getUsername()); assertEquals(PasswordEncoder.encode(user.getPassword(), user.getUsername()), loadUser.getPassword()); assertEquals(user.getOrganization(), loadUser.getOrganization()); assertEquals(user.getRoles(), loadUser.getRoles()); }
0
Java
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The use of a broken or risky cryptographic algorithm is an unnecessary risk that may result in the exposure of sensitive information.
https://cwe.mitre.org/data/definitions/327.html
vulnerable
public void corsEmpty() { InputStream is = getClass().getResourceAsStream("/allow-origin3.xml"); PolicyRestrictor restrictor = new PolicyRestrictor(is); assertTrue(restrictor.isOriginAllowed("http://bla.com", false)); assertTrue(restrictor.isOriginAllowed("http://www.jolokia.org", false)); assertTrue(restrictor.isOriginAllowed("http://www.consol.de", false)); }
1
Java
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
public ECB() { super(new BlockCipherProvider() { public BlockCipher get() { return new AESFastEngine(); } }); }
0
Java
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
vulnerable
private Runnable getDiscoveryRequestSetup(final String url) { return new Runnable() { public void run() { expect(request.getHeader("Origin")).andStubReturn(null); expect(request.getHeader("Referer")).andStubReturn(null); expect(request.getRemoteHost()).andReturn("localhost"); expect(request.getRemoteAddr()).andReturn("127.0.0.1"); expect(request.getRequestURI()).andReturn("/jolokia/"); expect(request.getParameterMap()).andReturn(null); expect(request.getAttribute(ConfigKey.JAAS_SUBJECT_REQUEST_ATTRIBUTE)).andReturn(null); expect(request.getPathInfo()).andReturn(HttpTestUtil.HEAP_MEMORY_GET_REQUEST); expect(request.getParameter(ConfigKey.MIME_TYPE.getKeyValue())).andReturn("text/plain").anyTimes(); StringBuffer buf = new StringBuffer(); buf.append(url).append(HttpTestUtil.HEAP_MEMORY_GET_REQUEST); expect(request.getRequestURL()).andReturn(buf); expect(request.getRequestURI()).andReturn("/jolokia" + HttpTestUtil.HEAP_MEMORY_GET_REQUEST); expect(request.getContextPath()).andReturn("/jolokia"); expect(request.getAuthType()).andReturn("BASIC"); expect(request.getAttribute("subject")).andReturn(null); expect(request.getParameter(ConfigKey.STREAMING.getKeyValue())).andReturn(null); } }; }
1
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public void performTest() throws Exception { testDefault(64, g512, p512); testEnc(); testGP("DH", 512, 0, g512, p512); testGP("DiffieHellman", 768, 0, g768, p768); testGP("DIFFIEHELLMAN", 1024, 0, g1024, p1024); testGP("DH", 512, 64, g512, p512); testGP("DiffieHellman", 768, 128, g768, p768); testGP("DIFFIEHELLMAN", 1024, 256, g1024, p1024); testExplicitWrapping(512, 0, g512, p512); testRandom(256); testECDH("ECDH"); testECDH("ECDHC"); testECDH("ECDH", "secp521r1", "AES", 256); testECDH("ECDH", "secp521r1", "DESEDE", 192); testECDH("ECDH", "secp521r1", "DES", 64); testECDH("ECDHwithSHA1KDF", "secp521r1", "AES", 256); testECDH("ECDHwithSHA1KDF", "secp521r1", "DESEDE", 192); testECDH("ECDH", "Curve25519", "AES", 256); testECDH("ECDH", "Curve25519", "DESEDE", 192); testECDH("ECDH", "Curve25519", "DES", 64); testECDH("ECDHwithSHA1KDF", "Curve25519", "AES", 256); testECDH("ECDHwithSHA1KDF", "Curve25519", "DESEDE", 192); testExceptions(); testDESAndDESede(g768, p768); testInitialise(); testSmallSecret(); testConfig(); testSubgroupConfinement(); }
1
Java
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
safe
public void test_like_endsWith() { Entity from = from(Entity.class); where(from.getCode()).like().endsWith("test"); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 where entity_0.code like '%test'", select.getQuery()); }
0
Java
NVD-CWE-noinfo
null
null
null
vulnerable
void checkVerificationCodeUnexistingUser() { when(this.userReference.toString()).thenReturn("user:Foobar"); when(this.userManager.exists(this.userReference)).thenReturn(false); String exceptionMessage = "User [user:Foobar] doesn't exist"; when(this.localizationManager.getTranslationPlain("xe.admin.passwordReset.error.noUser", "user:Foobar")).thenReturn(exceptionMessage); ResetPasswordException resetPasswordException = assertThrows(ResetPasswordException.class, () -> this.resetPasswordManager.checkVerificationCode(this.userReference, "some code")); assertEquals(exceptionMessage, resetPasswordException.getMessage()); }
0
Java
CWE-640
Weak Password Recovery Mechanism for Forgotten Password
The software contains a mechanism for users to recover or change their passwords without knowing the original password, but the mechanism is weak.
https://cwe.mitre.org/data/definitions/640.html
vulnerable
private static void checkCEKLength(final SecretKey cek, final EncryptionMethod enc) throws KeyLengthException { if (enc.cekBitLength() != ByteUtils.bitLength(cek.getEncoded())) { throw new KeyLengthException("The Content Encryption Key (CEK) length for " + enc + " must be " + enc.cekBitLength() + " bits"); } }
0
Java
CWE-345
Insufficient Verification of Data Authenticity
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
https://cwe.mitre.org/data/definitions/345.html
vulnerable
public BigInteger calculateAgreement( DHPublicKeyParameters pub, BigInteger message) { if (!pub.getParameters().equals(dhParams)) { throw new IllegalArgumentException("Diffie-Hellman public key has wrong parameters."); } BigInteger p = dhParams.getP(); BigInteger result = pub.getY().modPow(privateValue, p); if (result.compareTo(ONE) == 0) { throw new IllegalStateException("Shared key can't be 1"); } return message.modPow(key.getX(), p).multiply(result).mod(p); }
1
Java
CWE-320
Key Management Errors
Weaknesses in this category are related to errors in the management of cryptographic keys.
https://cwe.mitre.org/data/definitions/320.html
safe
static final ServerExtension server = new ServerExtension() { @Override protected void configure(ServerBuilder sb) throws Exception { sb.http(0); sb.https(0); sb.tlsSelfSigned(); sb.route().get("/headers-custom") .build((ctx, req) -> { final String param = new QueryStringDecoder(req.path()).parameters() .get("param").get(0); return HttpResponse.of( ResponseHeaders.of(HttpStatus.OK, "server-header", param), HttpData.ofUtf8("OK")); }); } };
1
Java
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
safe
public ECIESwithAESCBC() { super(new CBCBlockCipher(new AESEngine()), 16); }
0
Java
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
vulnerable
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String archivePath, String charset) { String filename = "checklist_" + StringHelper.transformDisplayNameToFileSystemName(getShortName()) + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis())); filename = ZipUtil.concat(archivePath, filename); Checklist checklist = loadOrCreateChecklist(course.getCourseEnvironment().getCoursePropertyManager()); String exportContent = XStreamHelper.createXStreamInstance().toXML(checklist); try { exportStream.putNextEntry(new ZipEntry(filename)); IOUtils.write(exportContent, exportStream, "UTF-8"); exportStream.closeEntry(); } catch (IOException e) { log.error("", e); } return true; }
0
Java
CWE-91
XML Injection (aka Blind XPath Injection)
The software does not properly neutralize special elements that are used in XML, allowing attackers to modify the syntax, content, or commands of the XML before it is processed by an end system.
https://cwe.mitre.org/data/definitions/91.html
vulnerable
public void setUp() throws Exception { context = oldcore.getXWikiContext(); Utils.setComponentManager(oldcore.getMocker()); QueryManager mockSecureQueryManager = oldcore.getMocker().registerMockComponent((Type) QueryManager.class, "secure"); mockTemplateProvidersQuery = mock(Query.class); when(mockSecureQueryManager.createQuery(any(), any())).thenReturn(mockTemplateProvidersQuery); when(mockTemplateProvidersQuery.execute()).thenReturn(Collections.emptyList()); when(oldcore.getMockContextualAuthorizationManager().hasAccess(any(Right.class), any(EntityReference.class))) .thenReturn(true); Provider<DocumentReference> mockDocumentReferenceProvider = oldcore.getMocker().registerMockComponent(DocumentReference.TYPE_PROVIDER); when(mockDocumentReferenceProvider.get()) .thenReturn(new DocumentReference("xwiki", Arrays.asList("Main"), "WebHome")); mockURLFactory = mock(XWikiURLFactory.class); context.setURLFactory(mockURLFactory); action = new CreateAction(); mockRequest = mock(XWikiRequest.class); context.setRequest(mockRequest); mockResponse = mock(XWikiResponse.class); context.setResponse(mockResponse); when(mockRequest.get("type")).thenReturn("plain"); this.oldcore.getMocker().registerMockComponent(ObservationManager.class); }
0
Java
CWE-862
Missing Authorization
The software does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
public void failingExample() throws Exception { assertThat(ConstraintViolations.format(validator.validate(new FailingExample()))) .containsExactlyInAnyOrder(FAILED_RESULT); assertThat(TestLoggerFactory.getAllLoggingEvents()) .isEmpty(); }
0
Java
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
private void verifyOfflineCause(Computer computer) throws Exception { XmlPage page = j.createWebClient().goToXml("computer/" + computer.getName() + "/config.xml"); String content = page.getWebResponse().getContentAsString("UTF-8"); assertThat(content, containsString("temporaryOfflineCause")); assertThat(content, containsString("<userId>username</userId>")); assertThat(content, not(containsString("ApiTokenProperty"))); assertThat(content, not(containsString("apiToken"))); }
1
Java
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
https://cwe.mitre.org/data/definitions/200.html
safe
private ECFieldElement fe(BigInteger x) { return DP.getCurve().fromBigInteger(x); }
1
Java
CWE-19
Data Processing Errors
Weaknesses in this category are typically found in functionality that processes data. Data processing is the manipulation of input to retrieve or save information.
https://cwe.mitre.org/data/definitions/19.html
safe
public void testMultiply2() { int COUNT = 100; ECFieldElement[] inputs = new ECFieldElement[COUNT]; BigInteger[] INPUTS = new BigInteger[COUNT]; for (int i = 0; i < inputs.length; ++i) { inputs[i] = generateMultiplyInput_Random(); INPUTS[i] = inputs[i].toBigInteger(); } for (int j = 0; j < inputs.length; ++j) { for (int k = 0; k < inputs.length; ++k) { BigInteger R = INPUTS[j].multiply(INPUTS[k]).mod(Q); ECFieldElement z = inputs[j].multiply(inputs[k]); BigInteger Z = z.toBigInteger(); assertEquals(R, Z); } } }
1
Java
CWE-19
Data Processing Errors
Weaknesses in this category are typically found in functionality that processes data. Data processing is the manipulation of input to retrieve or save information.
https://cwe.mitre.org/data/definitions/19.html
safe
public PBEWithSHA256AESCBC192() { super(new CBCBlockCipher(new AESEngine()), PKCS12, SHA256, 192, 16); }
1
Java
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
safe
private void handle(ServletRequestHandler pReqHandler,HttpServletRequest pReq, HttpServletResponse pResp) throws IOException { JSONAware json = null; try { // Check access policy requestHandler.checkClientIPAccess(pReq.getRemoteHost(),pReq.getRemoteAddr()); // Remember the agent URL upon the first request. Needed for discovery updateAgentUrlIfNeeded(pReq); // Dispatch for the proper HTTP request method json = pReqHandler.handleRequest(pReq,pResp); } catch (Throwable exp) { json = requestHandler.handleThrowable( exp instanceof RuntimeMBeanException ? ((RuntimeMBeanException) exp).getTargetException() : exp); } finally { setCorsHeader(pReq, pResp); String callback = pReq.getParameter(ConfigKey.CALLBACK.getKeyValue()); String answer = json != null ? json.toJSONString() : requestHandler.handleThrowable(new Exception("Internal error while handling an exception")).toJSONString(); if (callback != null) { // Send a JSONP response sendResponse(pResp, "text/javascript", callback + "(" + answer + ");"); } else { sendResponse(pResp, getMimeType(pReq),answer); } } }
0
Java
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
final protected CommandExecutionResult executeArg(TimingDiagram diagram, LineLocation location, RegexResult arg) { final String compact = arg.get("COMPACT", 0); final String code = arg.get("CODE", 0); final String full = arg.get("FULL", 0); return diagram.createBinary(code, full, compact != null); }
0
Java
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public SAXReader(boolean validating) { this.validating = validating; }
0
Java
CWE-611
Improper Restriction of XML External Entity Reference
The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.
https://cwe.mitre.org/data/definitions/611.html
vulnerable
public void export(Media media, ManifestBuilder manifest, File mediaArchiveDirectory, Locale locale) { EfficiencyStatement statement = null; if(StringHelper.containsNonWhitespace(media.getContent())) { try { statement = (EfficiencyStatement)myXStream.fromXML(media.getContent()); } catch (Exception e) { log.error("Cannot load efficiency statement from artefact", e); } } if(statement != null) { List<Map<String,Object>> assessmentNodes = statement.getAssessmentNodes(); List<AssessmentNodeData> assessmentNodeList = AssessmentHelper.assessmentNodeDataMapToList(assessmentNodes); SyntheticUserRequest ureq = new SyntheticUserRequest(media.getAuthor(), locale); IdentityAssessmentOverviewController details = new IdentityAssessmentOverviewController(ureq, new WindowControlMocker(), assessmentNodeList); super.exportContent(media, details.getInitialComponent(), null, mediaArchiveDirectory, locale); } }
0
Java
CWE-91
XML Injection (aka Blind XPath Injection)
The software does not properly neutralize special elements that are used in XML, allowing attackers to modify the syntax, content, or commands of the XML before it is processed by an end system.
https://cwe.mitre.org/data/definitions/91.html
vulnerable
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof ClassPathResource) { ClassPathResource otherRes = (ClassPathResource) obj; ClassLoader thisLoader = this.classLoader; ClassLoader otherLoader = otherRes.classLoader; return (this.path.equals(otherRes.path) && thisLoader.equals(otherLoader) && this.clazz.equals(otherRes.clazz)); } return false; }
1
Java
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
safe
public void existingDocumentFromUITemplateProviderSpecifiedTerminalOverridenFromUIToNonTerminal() throws Exception { // current document = xwiki:Main.WebHome DocumentReference documentReference = new DocumentReference("xwiki", Arrays.asList("Main"), "WebHome"); XWikiDocument document = mock(XWikiDocument.class); when(document.getDocumentReference()).thenReturn(documentReference); when(document.isNew()).thenReturn(false); when(document.getLocalReferenceMaxLength()).thenReturn(255); context.setDoc(document); // Submit from the UI spaceReference=X&name=Y&templateProvider=XWiki.MyTemplateProvider String templateProviderFullName = "XWiki.MyTemplateProvider"; String spaceReferenceString = "X"; when(mockRequest.getParameter("spaceReference")).thenReturn(spaceReferenceString); when(mockRequest.getParameter("name")).thenReturn("Y"); when(mockRequest.getParameter("templateprovider")).thenReturn(templateProviderFullName); when(mockRequest.getParameter("tocreate")).thenReturn("nonterminal"); // Mock 1 existing template provider that creates terminal documents. mockExistingTemplateProviders(templateProviderFullName, new DocumentReference("xwiki", Arrays.asList("XWiki"), "MyTemplateProvider"), Collections.EMPTY_LIST, true); // Run the action String result = action.render(context); // The tests are below this line! // Verify null is returned (this means the response has been returned) assertNull(result); // Note: We are creating the document X.Y.WebHome as non-terminal, even if the template provider says otherwise. // Also using a template, as specified in the template provider. verify(mockURLFactory).createURL("X.Y", "WebHome", "edit", "template=XWiki.MyTemplate&parent=Main.WebHome&title=Y", null, "xwiki", context); }
0
Java
CWE-862
Missing Authorization
The software does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
public ECKey(final Curve crv, final Base64URL x, final Base64URL y, final PrivateKey priv, final KeyUse use, final Set<KeyOperation> ops, final Algorithm alg, final String kid, final URI x5u, final Base64URL x5t, final Base64URL x5t256, final List<Base64> x5c, final KeyStore ks) { super(KeyType.EC, use, ops, alg, kid, x5u, x5t, x5t256, x5c, ks); if (crv == null) { throw new IllegalArgumentException("The curve must not be null"); } this.crv = crv; if (x == null) { throw new IllegalArgumentException("The 'x' coordinate must not be null"); } this.x = x; if (y == null) { throw new IllegalArgumentException("The 'y' coordinate must not be null"); } this.y = y; ensurePublicCoordinatesOnCurve(crv, x, y); d = null; this.privateKey = priv; }
1
Java
CWE-347
Improper Verification of Cryptographic Signature
The software does not verify, or incorrectly verifies, the cryptographic signature for data.
https://cwe.mitre.org/data/definitions/347.html
safe
public void testSafeBitLength_IntegerOverflow() { try { ByteUtils.safeBitLength(Integer.MAX_VALUE); fail(); } catch (IntegerOverflowException e) { assertEquals("Integer overflow", e.getMessage()); } }
1
Java
CWE-345
Insufficient Verification of Data Authenticity
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
https://cwe.mitre.org/data/definitions/345.html
safe
public VFSContainer createChildContainer(String name) { File fNewFile = new File(getBasefile(), name); if (!fNewFile.mkdir()) return null; LocalFolderImpl locFI = new LocalFolderImpl(fNewFile, this); locFI.setDefaultItemFilter(defaultFilter); return locFI; }
0
Java
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
public void testValidGroupIds() { testInvalidGroupId("John-Doe",false); testInvalidGroupId("Jane/Doe",false); testInvalidGroupId("John.Doe",false); testInvalidGroupId("Jane#Doe", false); testInvalidGroupId("John@Döe.com", false); testInvalidGroupId("JohnDoé", false); }
1
Java
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) { HttpServletRequest httpReq = (HttpServletRequest) request; HttpServletResponse httpResp = (HttpServletResponse) response; if ("GET".equals(httpReq.getMethod())) { Meteor meteor = Meteor.build(httpReq, SCOPE.REQUEST, Collections.<BroadcastFilter>emptyList(), null); String pushSessionId = httpReq.getParameter(PUSH_SESSION_ID_PARAM); Session session = null; if (pushSessionId != null) { ensureServletContextAvailable(request); PushContext pushContext = (PushContext) servletContext.getAttribute(PushContext.INSTANCE_KEY_NAME); session = pushContext.getSessionManager().getPushSession(pushSessionId); } if (session == null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(MessageFormat.format("Session {0} was not found", pushSessionId)); } httpResp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } httpResp.setContentType("text/plain"); try { Request pushRequest = new RequestImpl(meteor, session); httpReq.setAttribute(SESSION_ATTRIBUTE_NAME, session); httpReq.setAttribute(REQUEST_ATTRIBUTE_NAME, pushRequest); pushRequest.suspend(); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } return; } } }
0
Java
CWE-20
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
https://cwe.mitre.org/data/definitions/20.html
vulnerable
protected void engineInit( byte[] params) throws IOException { try { ASN1Sequence s = (ASN1Sequence)ASN1Primitive.fromByteArray(params); if (s.size() == 1) { this.currentSpec = new IESParameterSpec(null, null, ASN1Integer.getInstance(s.getObjectAt(0)).getValue().intValue()); } else if (s.size() == 2) { ASN1TaggedObject tagged = ASN1TaggedObject.getInstance(s.getObjectAt(0)); if (tagged.getTagNo() == 0) { this.currentSpec = new IESParameterSpec(ASN1OctetString.getInstance(tagged, false).getOctets(), null, ASN1Integer.getInstance(s.getObjectAt(1)).getValue().intValue()); } else { this.currentSpec = new IESParameterSpec(null, ASN1OctetString.getInstance(tagged, false).getOctets(), ASN1Integer.getInstance(s.getObjectAt(1)).getValue().intValue()); } } else { ASN1TaggedObject tagged1 = ASN1TaggedObject.getInstance(s.getObjectAt(0)); ASN1TaggedObject tagged2 = ASN1TaggedObject.getInstance(s.getObjectAt(1)); this.currentSpec = new IESParameterSpec(ASN1OctetString.getInstance(tagged1, false).getOctets(), ASN1OctetString.getInstance(tagged2, false).getOctets(), ASN1Integer.getInstance(s.getObjectAt(2)).getValue().intValue()); } } catch (ClassCastException e) { throw new IOException("Not a valid IES Parameter encoding."); } catch (ArrayIndexOutOfBoundsException e) { throw new IOException("Not a valid IES Parameter encoding."); } }
0
Java
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
vulnerable
private Path getFilePath(String path) { return baseDirPath.map(dir -> dir.resolve(path)).orElseGet(() -> Paths.get(path)); }
0
Java
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
private void decodeTest() { EllipticCurve curve = new EllipticCurve( new ECFieldFp(new BigInteger("6277101735386680763835789423207666416083908700390324961279")), // q new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16)); // b ECPoint p = ECPointUtil.decodePoint(curve, Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")); if (!p.getAffineX().equals(new BigInteger("188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", 16))) { fail("x uncompressed incorrectly"); } if (!p.getAffineY().equals(new BigInteger("7192b95ffc8da78631011ed6b24cdd573f977a11e794811", 16))) { fail("y uncompressed incorrectly"); } }
1
Java
CWE-347
Improper Verification of Cryptographic Signature
The software does not verify, or incorrectly verifies, the cryptographic signature for data.
https://cwe.mitre.org/data/definitions/347.html
safe
public void destroy(ClassLoader classLoader) { _classLoaderVelocityContexts.remove(classLoader); }
1
Java
CWE-264
Permissions, Privileges, and Access Controls
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.
https://cwe.mitre.org/data/definitions/264.html
safe
private static ECPublicKey generateECPublicKey(final ECKey.Curve curve) throws Exception { final ECParameterSpec ecParameterSpec = curve.toECParameterSpec(); KeyPairGenerator generator = KeyPairGenerator.getInstance("EC"); generator.initialize(ecParameterSpec); KeyPair keyPair = generator.generateKeyPair(); return (ECPublicKey) keyPair.getPublic(); }
0
Java
CWE-347
Improper Verification of Cryptographic Signature
The software does not verify, or incorrectly verifies, the cryptographic signature for data.
https://cwe.mitre.org/data/definitions/347.html
vulnerable
public RoutingResultBuilder rawParam(String name, String value) { pathParams().put(requireNonNull(name, "name"), ArmeriaHttpUtil.decodePath(requireNonNull(value, "value"))); return this; }
0
Java
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
public JWECryptoParts encrypt(final JWEHeader header, final byte[] clearText) throws JOSEException { JWEAlgorithm alg = header.getAlgorithm(); if (! alg.equals(JWEAlgorithm.DIR)) { throw new JOSEException(AlgorithmSupportMessage.unsupportedJWEAlgorithm(alg, SUPPORTED_ALGORITHMS)); } // Check key length matches encryption method EncryptionMethod enc = header.getEncryptionMethod(); if (enc.cekBitLength() != ByteUtils.safeBitLength(getKey().getEncoded())) { throw new KeyLengthException(enc.cekBitLength(), enc); } final Base64URL encryptedKey = null; // The second JWE part return ContentCryptoProvider.encrypt(header, clearText, getKey(), encryptedKey, getJCAContext()); }
1
Java
CWE-345
Insufficient Verification of Data Authenticity
The software does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data.
https://cwe.mitre.org/data/definitions/345.html
safe
protected StyleSignatureBasic getStyleSignature() { if (type == TimingStyle.CONCISE) return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, SName.concise); if (type == TimingStyle.ROBUST) return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, SName.robust); throw new IllegalStateException(); }
0
Java
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
protected void configureReader(XMLReader reader, DefaultHandler handler) throws DocumentException { // configure lexical handling SAXHelper.setParserProperty(reader, SAX_LEXICALHANDLER, handler); // try alternate property just in case SAXHelper.setParserProperty(reader, SAX_LEXICAL_HANDLER, handler); // register the DeclHandler if (includeInternalDTDDeclarations || includeExternalDTDDeclarations) { SAXHelper.setParserProperty(reader, SAX_DECL_HANDLER, handler); } // string interning SAXHelper.setParserFeature(reader, SAX_STRING_INTERNING, isStringInternEnabled()); try { // configure validation support reader.setFeature("http://xml.org/sax/features/validation", isValidating()); if (errorHandler != null) { reader.setErrorHandler(errorHandler); } else { reader.setErrorHandler(handler); } } catch (Exception e) { if (isValidating()) { throw new DocumentException("Validation not supported for" + " XMLReader: " + reader, e); } } }
1
Java
CWE-611
Improper Restriction of XML External Entity Reference
The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.
https://cwe.mitre.org/data/definitions/611.html
safe
public void run() { try { mcs.joinGroup(MULTICAST); ready.signal(); while(true) { byte[] buf = new byte[2048]; DatagramPacket p = new DatagramPacket(buf,buf.length); mcs.receive(p); SocketAddress sender = p.getSocketAddress(); // prepare a response TcpSlaveAgentListener tal = jenkins.getTcpSlaveAgentListener(); StringBuilder rsp = new StringBuilder("<hudson>"); tag(rsp,"version", Jenkins.VERSION); tag(rsp,"url", jenkins.getRootUrl()); tag(rsp,"server-id", jenkins.getLegacyInstanceId()); tag(rsp,"slave-port",tal==null?null:tal.getPort()); for (UDPBroadcastFragment f : UDPBroadcastFragment.all()) f.buildFragment(rsp,sender); rsp.append("</hudson>"); byte[] response = rsp.toString().getBytes("UTF-8"); mcs.send(new DatagramPacket(response,response.length,sender)); } } catch (ClosedByInterruptException e) { // shut down } catch (BindException e) { // if we failed to listen to UDP, just silently abandon it, as a stack trace // makes people unnecessarily concerned, for a feature that currently does no good. LOGGER.log(Level.WARNING, "Failed to listen to UDP port "+PORT,e); } catch (IOException e) { if (shutdown) return; // forcibly closed LOGGER.log(Level.WARNING, "UDP handling problem",e); } }
1
Java
NVD-CWE-noinfo
null
null
null
safe
private Runnable getStandardResponseSetup() { return new Runnable() { public void run() { response.setCharacterEncoding("utf-8"); // The default content type response.setContentType("text/plain"); response.setStatus(200); } }; }
1
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public void testPreventBogusFromSerializing() throws IOException, ClassNotFoundException { Serializable[] serializables = new Serializable[] { new AtomicBoolean(false), TypeToken.of(String.class), }; for (Serializable s : serializables) { try { serialize(s); fail(s.getClass() + " should fail"); } catch (NotSerializableException e) { // all is well } } }
1
Java
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
safe
public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException { owner.checkPermission(Jenkins.RUN_SCRIPTS); rsp.setContentType("application/octet-stream"); FilePath dump = obtain(); try { dump.copyTo(rsp.getCompressedOutputStream(req)); } finally { dump.delete(); } }
1
Java
CWE-264
Permissions, Privileges, and Access Controls
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.
https://cwe.mitre.org/data/definitions/264.html
safe
public void testValidUserIds() { testInvalidUserId("John-Doe",false); testInvalidUserId("Jane/Doe",false); testInvalidUserId("John.Doe",false); testInvalidUserId("Jane#Doe", false); testInvalidUserId("John@Döe.com", false); testInvalidUserId("JohnDoé", false); }
1
Java
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
safe
public static void initializeSsl() { try { SSLContext sc = SSLContext.getInstance(SSL); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } catch (NoSuchAlgorithmException | KeyManagementException e) { throw ErrorUtil.createCommandException("initializing SSL failed: " + e.getMessage()); } }
0
Java
CWE-306
Missing Authentication for Critical Function
The software does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.
https://cwe.mitre.org/data/definitions/306.html
vulnerable
public void translate(TextPacket packet, GeyserSession session) { String message = packet.getMessage(); if (MessageTranslator.isTooLong(message, session)) { return; } ClientChatPacket chatPacket = new ClientChatPacket(message); session.sendDownstreamPacket(chatPacket); }
0
Java
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
public void testInvalidCallbackGetStreaming() throws IOException, URISyntaxException, ParseException { checkInvalidCallback(true); }
1
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
private String clean(String svg) { svg = svg.toLowerCase().replaceAll("\\s", ""); if (svg.contains("<script>")) return EMPTY_SVG; if (svg.contains("</script>")) return EMPTY_SVG; if (svg.contains("<foreignobject")) return EMPTY_SVG; if (svg.contains("</foreignobject>")) return EMPTY_SVG; return svg; }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public ClassPathResource(String path, ClassLoader classLoader) { Assert.notNull(path, "Path must not be null"); Assert.isTrue(isValid(path), "Path is not valid"); String pathToUse = StringUtils.cleanPath(path); if (pathToUse.startsWith("/")) { pathToUse = pathToUse.substring(1); } this.path = pathToUse; this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader()); }
1
Java
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
safe
public OFB() { super(new BufferedBlockCipher(new OFBBlockCipher(new AESFastEngine(), 128)), 128); }
0
Java
CWE-310
Cryptographic Issues
Weaknesses in this category are related to the design and implementation of data confidentiality and integrity. Frequently these deal with the use of encoding techniques, encryption libraries, and hashing algorithms. The weaknesses in this category could lead to a degradation of the quality data if they are not addressed.
https://cwe.mitre.org/data/definitions/310.html
vulnerable
public static AsciiString of(AsciiString name) { final AsciiString lowerCased = name.toLowerCase(); final AsciiString cached = map.get(lowerCased); return cached != null ? cached : lowerCased; }
0
Java
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
vulnerable
void multipleValuesPerNameIterator() { final HttpHeadersBase headers = newEmptyHeaders(); headers.add("name1", "value1"); headers.add("name1", "value2"); assertThat(headers.size()).isEqualTo(2); final List<String> values = ImmutableList.copyOf(headers.valueIterator("name1")); assertThat(values).containsExactly("value1", "value2"); }
1
Java
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
safe
protected EntityResolver createDefaultEntityResolver(String systemId) { String prefix = null; if ((systemId != null) && (systemId.length() > 0)) { int idx = systemId.lastIndexOf('/'); if (idx > 0) { prefix = systemId.substring(0, idx + 1); } } return new SAXEntityResolver(prefix); }
0
Java
CWE-611
Improper Restriction of XML External Entity Reference
The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.
https://cwe.mitre.org/data/definitions/611.html
vulnerable
public void translate(RespawnPacket packet, GeyserSession session) { if (packet.getState() == RespawnPacket.State.CLIENT_READY) { // Previously we only sent the respawn packet before the server finished loading // The message included was 'Otherwise when immediate respawn is on the client never loads' // But I assume the new if statement below fixes that problem RespawnPacket respawnPacket = new RespawnPacket(); respawnPacket.setRuntimeEntityId(0); respawnPacket.setPosition(Vector3f.ZERO); respawnPacket.setState(RespawnPacket.State.SERVER_READY); session.sendUpstreamPacket(respawnPacket); if (session.isSpawned()) { // Client might be stuck; resend spawn information PlayerEntity entity = session.getPlayerEntity(); if (entity == null) return; SetEntityDataPacket entityDataPacket = new SetEntityDataPacket(); entityDataPacket.setRuntimeEntityId(entity.getGeyserId()); entityDataPacket.getMetadata().putAll(entity.getMetadata()); session.sendUpstreamPacket(entityDataPacket); MovePlayerPacket movePlayerPacket = new MovePlayerPacket(); movePlayerPacket.setRuntimeEntityId(entity.getGeyserId()); movePlayerPacket.setPosition(entity.getPosition()); movePlayerPacket.setRotation(entity.getBedrockRotation()); movePlayerPacket.setMode(MovePlayerPacket.Mode.RESPAWN); session.sendUpstreamPacket(movePlayerPacket); } ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); } }
0
Java
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
public BCXMSSMTPrivateKey(PrivateKeyInfo keyInfo) throws IOException { XMSSMTKeyParams keyParams = XMSSMTKeyParams.getInstance(keyInfo.getPrivateKeyAlgorithm().getParameters()); this.treeDigest = keyParams.getTreeDigest().getAlgorithm(); XMSSPrivateKey xmssMtPrivateKey = XMSSPrivateKey.getInstance(keyInfo.parsePrivateKey()); try { XMSSMTPrivateKeyParameters.Builder keyBuilder = new XMSSMTPrivateKeyParameters .Builder(new XMSSMTParameters(keyParams.getHeight(), keyParams.getLayers(), DigestUtil.getDigest(treeDigest))) .withIndex(xmssMtPrivateKey.getIndex()) .withSecretKeySeed(xmssMtPrivateKey.getSecretKeySeed()) .withSecretKeyPRF(xmssMtPrivateKey.getSecretKeyPRF()) .withPublicSeed(xmssMtPrivateKey.getPublicSeed()) .withRoot(xmssMtPrivateKey.getRoot()); if (xmssMtPrivateKey.getBdsState() != null) { keyBuilder.withBDSState((BDSStateMap)XMSSUtil.deserialize(xmssMtPrivateKey.getBdsState())); } this.keyParams = keyBuilder.build(); } catch (ClassNotFoundException e) { throw new IOException("ClassNotFoundException processing BDS state: " + e.getMessage()); } }
0
Java
CWE-502
Deserialization of Untrusted Data
The application deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
protected void runTeardown() { Assert.assertTrue("HTTP connection is not allowed", messagedAccessDenied); }
0
Java
CWE-862
Missing Authorization
The software does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
private String getLocalePrefix(FacesContext context) { String localePrefix = null; localePrefix = context.getExternalContext().getRequestParameterMap().get("loc"); if(localePrefix != null && !nameContainsForbiddenSequence(localePrefix)){ return localePrefix; } String appBundleName = context.getApplication().getMessageBundle(); if (null != appBundleName) { Locale locale = null; if (context.getViewRoot() != null) { locale = context.getViewRoot().getLocale(); } else { locale = context.getApplication().getViewHandler().calculateLocale(context); } try { ResourceBundle appBundle = ResourceBundle.getBundle(appBundleName, locale, Util.getCurrentLoader(ResourceManager.class)); localePrefix = appBundle .getString(ResourceHandler.LOCALE_PREFIX); } catch (MissingResourceException mre) { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "Ignoring missing resource", mre); } } } return localePrefix; }
1
Java
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
safe
public void translate(ServerUpdateTimePacket packet, GeyserSession session) { // Bedrock sends a GameRulesChangedPacket if there is no daylight cycle // Java just sends a negative long if there is no daylight cycle long time = packet.getTime(); // https://minecraft.gamepedia.com/Day-night_cycle#24-hour_Minecraft_day SetTimePacket setTimePacket = new SetTimePacket(); setTimePacket.setTime((int) Math.abs(time) % 24000); session.sendUpstreamPacket(setTimePacket); if (!session.isDaylightCycle() && time >= 0) { // Client thinks there is no daylight cycle but there is session.setDaylightCycle(true); } else if (session.isDaylightCycle() && time < 0) { // Client thinks there is daylight cycle but there isn't session.setDaylightCycle(false); } }
0
Java
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
private Job startCreateJob(EntityReference entityReference, EditForm editForm) throws XWikiException { if (StringUtils.isBlank(editForm.getTemplate())) { // No template specified, nothing more to do. return null; } // If a template is set in the request, then this is a create action which needs to be handled by a create job, // but skipping the target document, which is now already saved by the save action. RefactoringScriptService refactoring = (RefactoringScriptService) Utils.getComponent(ScriptService.class, "refactoring"); CreateRequest request = refactoring.getRequestFactory().createCreateRequest(Arrays.asList(entityReference)); request.setCheckAuthorRights(false); // Set the target document. request.setEntityReferences(Arrays.asList(entityReference)); // Set the template to use. DocumentReferenceResolver<String> resolver = Utils.getComponent(DocumentReferenceResolver.TYPE_STRING, "currentmixed"); EntityReference templateReference = resolver.resolve(editForm.getTemplate()); request.setTemplateReference(templateReference); // We`ve already created and populated the fields of the target document, focus only on the remaining children // specified in the template. request.setSkippedEntities(Arrays.asList(entityReference)); Job createJob = refactoring.create(request); if (createJob != null) { return createJob; } else { throw new XWikiException(String.format("Failed to schedule the create job for [%s]", entityReference), refactoring.getLastError()); } }
0
Java
CWE-862
Missing Authorization
The software does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
void validSaveRequestImageUploadAndConflictCheck() throws Exception { when(mockDocument.getRCSVersion()).thenReturn(new Version("1.2")); when(mockClonedDocument.getRCSVersion()).thenReturn(new Version("1.2")); when(mockClonedDocument.getComment()).thenReturn("My Changes"); when(mockClonedDocument.getLock(this.context)).thenReturn(mock(XWikiLock.class)); when(mockForm.getTemplate()).thenReturn(""); when(this.propertiesConf.getProperty("edit.conflictChecking.enabled")).thenReturn(true); when(mockRequest.getParameter("previousVersion")).thenReturn("1.1"); context.put("ajax", true); when(mockRequest.getParameter("forceSave")).thenReturn(""); when(mockRequest.getParameter("isNew")).thenReturn("true"); when(mockDocument.getDate()).thenReturn(new Date(42)); when(mockRequest.getParameter("editingVersionDate")).thenReturn("43"); when(this.documentRevisionProvider.getRevision(mockDocument, "1.1")).thenReturn(mock(XWikiDocument.class)); when(mockDocument.getContentDiff("1.1", "1.2", context)).thenReturn(Collections.emptyList()); when(mockDocument.getMetaDataDiff("1.1", "1.2", context)).thenReturn(Collections.emptyList()); when(mockDocument.getObjectDiff("1.1", "1.2", context)).thenReturn(Collections.emptyList()); assertFalse(saveAction.save(this.context)); assertEquals(new Version("1.2"), this.context.get("SaveAction.savedObjectVersion")); verify(mockClonedDocument).readFromTemplate("", this.context); verify(mockClonedDocument).setAuthor("XWiki.FooBar"); verify(mockClonedDocument).setMetaDataDirty(true); verify(this.xWiki).checkSavingDocument(USER_REFERENCE, mockClonedDocument, "My Changes", false, this.context); verify(this.xWiki).saveDocument(mockClonedDocument, "My Changes", false, this.context); verify(mockClonedDocument).removeLock(this.context); }
0
Java
CWE-862
Missing Authorization
The software does not perform an authorization check when an actor attempts to access a resource or perform an action.
https://cwe.mitre.org/data/definitions/862.html
vulnerable
protected BigInteger chooseRandomPrime(int bitlength, BigInteger e, BigInteger sqrdBound) { for (int i = 0; i != 5 * bitlength; i++) { BigInteger p = new BigInteger(bitlength, 1, param.getRandom()); if (p.mod(e).equals(ONE)) { continue; } if (p.multiply(p).compareTo(sqrdBound) < 0) { continue; } if (!isProbablePrime(p)) { continue; } if (!e.gcd(p.subtract(ONE)).equals(ONE)) { continue; } return p; } throw new IllegalStateException("unable to generate prime number for RSA key"); }
1
Java
CWE-327
Use of a Broken or Risky Cryptographic Algorithm
The use of a broken or risky cryptographic algorithm is an unnecessary risk that may result in the exposure of sensitive information.
https://cwe.mitre.org/data/definitions/327.html
safe
private static void validateName(String name) { if (!RE_NAME.matcher(name).matches()) { throw new IllegalArgumentException(String.format("Illegal character in name: '%s'.", name)); } }
1
Java
CWE-91
XML Injection (aka Blind XPath Injection)
The software does not properly neutralize special elements that are used in XML, allowing attackers to modify the syntax, content, or commands of the XML before it is processed by an end system.
https://cwe.mitre.org/data/definitions/91.html
safe
public String extractPathWithinPattern(String pattern, String path) { final String[] patternParts = tokenizeToStringArray(pattern, this.pathSeparator); final String[] pathParts = tokenizeToStringArray(path, this.pathSeparator); final StringBuilder buffer = new StringBuilder(); // Add any path parts that have a wildcarded pattern part. int puts = 0; for (int i = 0; i < patternParts.length; i++) { final String patternPart = patternParts[i]; if ((patternPart.indexOf('*') > -1 || patternPart.indexOf('?') > -1) && pathParts.length >= i + 1) { if (puts > 0 || (i == 0 && !pattern.startsWith(this.pathSeparator))) { buffer.append(this.pathSeparator); } buffer.append(pathParts[i]); puts++; } } // Append any trailing path parts. for (int i = patternParts.length; i < pathParts.length; i++) { if (puts > 0 || i > 0) { buffer.append(this.pathSeparator); } buffer.append(pathParts[i]); } return buffer.toString(); }
0
Java
CWE-264
Permissions, Privileges, and Access Controls
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.
https://cwe.mitre.org/data/definitions/264.html
vulnerable
public String getAllowEcpFlow() { if (getAttributes() == null) return null; return getAttributes().get(SamlConfigAttributes.SAML_ALLOW_ECP_FLOW); }
1
Java
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
safe
public void spliceToFile() throws Throwable { EventLoopGroup group = new EpollEventLoopGroup(1); File file = PlatformDependent.createTempFile("netty-splice", null, null); file.deleteOnExit(); SpliceHandler sh = new SpliceHandler(file); ServerBootstrap bs = new ServerBootstrap(); bs.channel(EpollServerSocketChannel.class); bs.group(group).childHandler(sh); bs.childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); Channel sc = bs.bind(NetUtil.LOCALHOST, 0).syncUninterruptibly().channel(); Bootstrap cb = new Bootstrap(); cb.group(group); cb.channel(EpollSocketChannel.class); cb.handler(new ChannelInboundHandlerAdapter()); Channel cc = cb.connect(sc.localAddress()).syncUninterruptibly().channel(); for (int i = 0; i < data.length;) { int length = Math.min(random.nextInt(1024 * 64), data.length - i); ByteBuf buf = Unpooled.wrappedBuffer(data, i, length); cc.writeAndFlush(buf); i += length; } while (sh.future2 == null || !sh.future2.isDone() || !sh.future.isDone()) { if (sh.exception.get() != null) { break; } try { Thread.sleep(50); } catch (InterruptedException e) { // Ignore. } } sc.close().sync(); cc.close().sync(); if (sh.exception.get() != null && !(sh.exception.get() instanceof IOException)) { throw sh.exception.get(); } byte[] written = new byte[data.length]; FileInputStream in = new FileInputStream(file); try { Assert.assertEquals(written.length, in.read(written)); Assert.assertArrayEquals(data, written); } finally { in.close(); group.shutdownGracefully(); } }
1
Java
CWE-379
Creation of Temporary File in Directory with Insecure Permissions
The software creates a temporary file in a directory whose permissions allow unintended actors to determine the file's existence or otherwise access that file.
https://cwe.mitre.org/data/definitions/379.html
safe
public boolean verify(final String host, final String certHostname) { return certHostname != null && !certHostname.isEmpty(); }
1
Java
CWE-755
Improper Handling of Exceptional Conditions
The software does not handle or incorrectly handles an exceptional condition.
https://cwe.mitre.org/data/definitions/755.html
safe
public boolean match(final String pattern, final String path) { return doMatch(pattern, path, true); }
0
Java
CWE-264
Permissions, Privileges, and Access Controls
Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control.
https://cwe.mitre.org/data/definitions/264.html
vulnerable
public void translate(ServerEntityTeleportPacket packet, GeyserSession session) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); } if (entity == null) return; entity.teleport(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), packet.isOnGround()); }
0
Java
CWE-287
Improper Authentication
When an actor claims to have a given identity, the software does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
public ViolationCollector(ConstraintValidatorContext constraintValidatorContext, boolean escapeExpressions) { this.constraintValidatorContext = constraintValidatorContext; this.escapeExpressions = escapeExpressions; }
1
Java
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/74.html
safe
public String displayCategoryWithReference(@PathVariable final String friendlyUrl, @PathVariable final String ref, Model model, HttpServletRequest request, HttpServletResponse response, Locale locale) throws Exception { return this.displayCategory(friendlyUrl,ref,model,request,response,locale); }
1
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public void testValidUserIds() { testInvalidUserId("John-Doe",false); testInvalidUserId("Jane/Doe",false); testInvalidUserId("John.Doe",false); testInvalidUserId("Jane#Doe", false); testInvalidUserId("John@Döe.com", false); testInvalidUserId("JohnDoé", false); }
1
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
safe
public HomePageConfig loadConfigFor(Identity identity) { String userName = identity.getName(); HomePageConfig retVal = null; File configFile = getConfigFile(userName); if (!configFile.exists()) { // config file does not exist! create one, init the defaults, save it. retVal = loadAndSaveDefaults(identity); } else { // file exists, load it with XStream, resolve version try { Object tmp = homeConfigXStream.fromXML(configFile); if (tmp instanceof HomePageConfig) { retVal = (HomePageConfig)tmp; if(retVal.resolveVersionIssues()) { saveConfigTo(identity, retVal); } } } catch (Exception e) { log.error("Error while loading homepage config from path::" + configFile.getAbsolutePath() + ", fallback to default configuration", e); FileUtils.deleteFile(configFile); retVal = loadAndSaveDefaults(identity); // show message to user } } return retVal; }
0
Java
CWE-91
XML Injection (aka Blind XPath Injection)
The software does not properly neutralize special elements that are used in XML, allowing attackers to modify the syntax, content, or commands of the XML before it is processed by an end system.
https://cwe.mitre.org/data/definitions/91.html
vulnerable
protected String getCorsDomain(String referer, String userAgent) { String dom = null; if (referer != null && referer.toLowerCase() .matches("https?://([a-z0-9,-]+[.])*draw[.]io/.*")) { dom = referer.toLowerCase().substring(0, referer.indexOf(".draw.io/") + 8); } else if (referer != null && referer.toLowerCase() .matches("https?://([a-z0-9,-]+[.])*diagrams[.]net/.*")) { dom = referer.toLowerCase().substring(0, referer.indexOf(".diagrams.net/") + 13); } else if (referer != null && referer.toLowerCase() .matches("https?://([a-z0-9,-]+[.])*quipelements[.]com/.*")) { dom = referer.toLowerCase().substring(0, referer.indexOf(".quipelements.com/") + 17); } // Enables Confluence/Jira proxy via referer or hardcoded user-agent (for old versions) // UA refers to old FF on macOS so low risk and fixes requests from existing servers else if ((referer != null && referer.equals("draw.io Proxy Confluence Server")) || (userAgent != null && userAgent.equals( "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:50.0) Gecko/20100101 Firefox/50.0"))) { dom = ""; } return dom; }
0
Java
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public <T extends JiffleRuntime> T getRuntimeInstance(Class<T> baseClass) throws it.geosolutions.jaiext.jiffle.JiffleException { RuntimeModel model = RuntimeModel.get(baseClass); if (model == null) { throw new it.geosolutions.jaiext.jiffle.JiffleException(baseClass.getName() + " does not implement a required Jiffle runtime interface"); } return (T) createRuntimeInstance(model, baseClass, false); }
0
Java
CWE-94
Improper Control of Generation of Code ('Code Injection')
The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
https://cwe.mitre.org/data/definitions/94.html
vulnerable