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 PersistentTask createTask(String name, Serializable task) { PersistentTask ptask = new PersistentTask(); Date currentDate = new Date(); ptask.setCreationDate(currentDate); ptask.setLastModified(currentDate); ptask.setName(name); ptask.setStatus(TaskStatus.newTask); ptask.setTask(xstream.toXML(task)); dbInstance.getCurrentEntityManager().persist(ptask); return ptask; }
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 testEntityExpansionWReq2() throws Exception { String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/federation?"; url += "wa=wsignin1.0"; url += "&whr=urn:org:apache:cxf:fediz:idp:realm-A"; url += "&wtrealm=urn:org:apache:cxf:fediz:fedizhelloworld"; String wreply = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName() + "/secure/fedservlet"; url += "&wreply=" + wreply; InputStream is = this.getClass().getClassLoader().getResource("entity_wreq2.xml").openStream(); String entity = IOUtils.toString(is, "UTF-8"); is.close(); String validWreq = "<RequestSecurityToken xmlns=\"http://docs.oasis-open.org/ws-sx/ws-trust/200512\">" + "<TokenType>&m;http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</TokenType>" + "</RequestSecurityToken>"; url += "&wreq=" + URLEncoder.encode(entity + validWreq, "UTF-8"); String user = "alice"; String password = "ecila"; final WebClient webClient = new WebClient(); webClient.getOptions().setUseInsecureSSL(true); webClient.getCredentialsProvider().setCredentials( new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())), new UsernamePasswordCredentials(user, password)); webClient.getOptions().setJavaScriptEnabled(false); try { webClient.getPage(url); Assert.fail("Failure expected on a bad wreq value"); } catch (FailingHttpStatusCodeException ex) { Assert.assertEquals(ex.getStatusCode(), 400); } webClient.close(); }
1
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
safe
private HtmlForm getRekeyForm(WebClient wc) throws IOException, SAXException { return wc.goTo("/manage").getFormByName("rekey"); }
1
Java
NVD-CWE-noinfo
null
null
null
safe
public void multipleHeadersContentLengthDifferent() throws Exception { multipleHeadersContentLength(false); }
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
private String encryptNew(String str) { return Secret.fromString(str).getEncryptedValue(); }
1
Java
NVD-CWE-noinfo
null
null
null
safe
public static long compileTime() { return 1649510957985L; }
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 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
public Document read(URL url) throws DocumentException { String systemID = url.toExternalForm(); InputSource source = new InputSource(systemID); if (this.encoding != null) { source.setEncoding(this.encoding); } return read(source); }
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 spliceToFile() throws Throwable { EventLoopGroup group = new EpollEventLoopGroup(1); File file = File.createTempFile("netty-splice", 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(); } }
0
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
vulnerable
void testEqualsInsertionOrderSameHeaderName() { final HttpHeadersBase h1 = newEmptyHeaders(); h1.add("a", "b"); h1.add("a", "c"); final HttpHeadersBase h2 = newEmptyHeaders(); h2.add("a", "c"); h2.add("a", "b"); assertThat(h1).isNotEqualTo(h2); }
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
void space() { final PathAndQuery res = parse("/ ? "); assertThat(res).isNotNull(); assertThat(res.path()).isEqualTo("/%20"); assertThat(res.query()).isEqualTo("+"); final PathAndQuery res2 = parse("/%20?%20"); assertThat(res2).isNotNull(); assertThat(res2.path()).isEqualTo("/%20"); assertThat(res2.query()).isEqualTo("+"); }
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
private void multipleHeadersContentLength(boolean same) throws Exception { int padding = 10; when(connection.isServer()).thenReturn(true); Http2Headers headers = new DefaultHttp2Headers(); if (same) { headers.addLong(HttpHeaderNames.CONTENT_LENGTH, 0); headers.addLong(HttpHeaderNames.CONTENT_LENGTH, 0); } else { headers.addLong(HttpHeaderNames.CONTENT_LENGTH, 0); headers.addLong(HttpHeaderNames.CONTENT_LENGTH, 1); } decode().onHeadersRead(ctx, STREAM_ID, headers, padding, true); if (same) { verify(listener, times(1)).onHeadersRead(eq(ctx), anyInt(), any(Http2Headers.class), anyInt(), anyShort(), anyBoolean(), anyInt(), anyBoolean()); assertEquals(1, headers.getAll(HttpHeaderNames.CONTENT_LENGTH).size()); } else { // Verify that the event was absorbed and not propagated to the observer. verify(listener, never()).onHeadersRead(eq(ctx), anyInt(), any(Http2Headers.class), anyInt(), anyShort(), anyBoolean(), anyInt(), anyBoolean()); } }
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 doesNotPrefixAliasedFunctionCallNameWithMultipleNumericParameters() { String query = "SELECT SUBSTRING(m.name, 2, 5) AS trimmedName FROM Magazine m"; Sort sort = new Sort("trimmedName"); assertThat(applySorting(query, sort, "m"), endsWith("order by trimmedName asc")); }
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 static Archive<?> createTestArchive2() { WebArchive war = ShrinkWrap.create(WebArchive.class, "RESTEASY-1073-no-expand.war") .addClasses(TestApplication.class) .addClasses(TestResource.class, TestWrapper.class) .addAsWebInfResource("web_no_expand.xml", "web.xml") ; System.out.println(war.toString(true)); return war; }
1
Java
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
safe
public byte[] allocateJobCaches(byte[] cacheAllocationRequestBytes) { CacheAllocationRequest allocationRequest = (CacheAllocationRequest) SerializationUtils .deserialize(cacheAllocationRequestBytes); return SerializationUtils.serialize((Serializable) jobManager.allocateJobCaches( getJobToken(), allocationRequest.getCurrentTime(), allocationRequest.getInstances())); }
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
setStringInputSource(ThreadContext context, IRubyObject data, IRubyObject url) { source = new InputSource(); ParserContext.setUrl(context, source, url); Ruby ruby = context.getRuntime(); if (!(data instanceof RubyString)) { throw ruby.newArgumentError("must be kind_of String"); } RubyString stringData = (RubyString) data; if (stringData.encoding(context) != null) { RubyString stringEncoding = stringData.encoding(context).asString(); String encName = NokogiriHelpers.getValidEncodingOrNull(stringEncoding); if (encName != null) { java_encoding = encName; } } ByteList bytes = stringData.getByteList(); stringDataSize = bytes.length() - bytes.begin(); ByteArrayInputStream stream = new ByteArrayInputStream(bytes.unsafeBytes(), bytes.begin(), bytes.length()); source.setByteStream(stream); source.setEncoding(java_encoding); }
0
Java
CWE-241
Improper Handling of Unexpected Data Type
The software does not handle or incorrectly handles when a particular element is not the expected type, e.g. it expects a digit (0-9) but is provided with a letter (A-Z).
https://cwe.mitre.org/data/definitions/241.html
vulnerable
private Template getClassloaderTemplate(String suffixPath, String templateName) { return getClassloaderTemplate(Thread.currentThread().getContextClassLoader(), suffixPath, templateName); }
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 initConfigMocks(String[] pInitParams, String[] pContextParams,String pLogRegexp, Class<? extends Exception> pExceptionClass) { config = createMock(ServletConfig.class); context = createMock(ServletContext.class); String[] params = pInitParams != null ? Arrays.copyOf(pInitParams,pInitParams.length + 2) : new String[2]; params[params.length - 2] = ConfigKey.DEBUG.getKeyValue(); params[params.length - 1] = "true"; HttpTestUtil.prepareServletConfigMock(config,params); HttpTestUtil.prepareServletContextMock(context, pContextParams); expect(config.getServletContext()).andStubReturn(context); expect(config.getServletName()).andStubReturn("jolokia"); if (pExceptionClass != null) { context.log(find(pLogRegexp),isA(pExceptionClass)); } else { if (pLogRegexp != null) { context.log(find(pLogRegexp)); } else { context.log((String) anyObject()); } } context.log((String) anyObject()); expectLastCall().asStub(); context.log(find("TestDetector"),isA(RuntimeException.class)); }
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 RekeySecretAdminMonitor() throws IOException { // if JENKINS_HOME existed <1.497, we need to offer rewrite // this computation needs to be done and the value be captured, // since $JENKINS_HOME/config.xml can be saved later before the user has // actually rewritten XML files. Jenkins j = Jenkins.getInstance(); if (j.isUpgradedFromBefore(new VersionNumber("1.496.*")) && new FileBoolean(new File(j.getRootDir(),"secret.key.not-so-secret")).isOff()) needed.on(); }
1
Java
NVD-CWE-noinfo
null
null
null
safe
public void translate(ServerPingPacket packet, GeyserSession session) { session.sendDownstreamPacket(new ClientPongPacket(packet.getId())); }
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 ModelAndView renameGroup(HttpServletRequest request, HttpServletResponse response) throws Exception { String oldName = request.getParameter("groupName"); String newName = request.getParameter("newName"); if (StringUtils.hasText(oldName) && StringUtils.hasText(newName)) { m_groupRepository.renameGroup(oldName, newName); } return listGroups(request, response); }
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 DefaultFileSystemResourceLoader() { this.baseDirPath = Optional.empty(); }
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 static boolean isValidCallback(String pCallback) { Pattern validJavaScriptFunctionNamePattern = Pattern.compile("^[$A-Z_][0-9A-Z_$]*$", Pattern.CASE_INSENSITIVE); return validJavaScriptFunctionNamePattern.matcher(pCallback).matches(); }
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 byte[] readBinary(int length) throws TException { if (length == 0) { return new byte[0]; } ensureContainerHasEnough(length, TType.BYTE); byte[] buf = new byte[length]; trans_.readAll(buf, 0, length); return buf; }
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 void invalidExample() throws Exception { assertThat(ConstraintViolations.format(validator.validate(new InvalidExample()))) .isEmpty(); assertThat(TestLoggerFactory.getAllLoggingEvents()) .containsExactlyInAnyOrder( new LoggingEvent( Level.ERROR, "The method {} is annotated with @SelfValidation but does not have a single parameter of type {}", InvalidExample.class.getMethod("validateFailAdditionalParameters", ViolationCollector.class, int.class), ViolationCollector.class ), new LoggingEvent( Level.ERROR, "The method {} is annotated with @SelfValidation but does not return void. It is ignored", InvalidExample.class.getMethod("validateFailReturn", ViolationCollector.class) ), new LoggingEvent( Level.ERROR, "The method {} is annotated with @SelfValidation but is not public", InvalidExample.class.getDeclaredMethod("validateFailPrivate", ViolationCollector.class) ) ); }
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 verifyHostname(X509Certificate cert) throws CertificateParsingException { try { Collection sans = cert.getSubjectAlternativeNames(); if (sans == null) { String dn = cert.getSubjectX500Principal().getName(); LdapName ln = new LdapName(dn); for (Rdn rdn : ln.getRdns()) { if (rdn.getType().equalsIgnoreCase("CN")) { String peer = client.getServerName().toLowerCase(); if (peer.equals(((String)rdn.getValue()).toLowerCase())) return; } } } else { Iterator i = sans.iterator(); while (i.hasNext()) { List nxt = (List)i.next(); if (((Integer)nxt.get(0)).intValue() == 2) { String peer = client.getServerName().toLowerCase(); if (peer.equals(((String)nxt.get(1)).toLowerCase())) return; } else if (((Integer)nxt.get(0)).intValue() == 7) { String peer = ((CConn)client).getSocket().getPeerAddress(); if (peer.equals(((String)nxt.get(1)).toLowerCase())) return; } } } Object[] answer = {"YES", "NO"}; int ret = JOptionPane.showOptionDialog(null, "Hostname verification failed. Do you want to continue?", "Hostname Verification Failure", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, answer, answer[0]); if (ret != JOptionPane.YES_OPTION) throw new WarningException("Hostname verification failed."); } catch (CertificateParsingException e) { throw new SystemException(e.getMessage()); } catch (InvalidNameException e) { throw new SystemException(e.getMessage()); } }
0
Java
CWE-295
Improper Certificate Validation
The software does not validate, or incorrectly validates, a certificate.
https://cwe.mitre.org/data/definitions/295.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 void testMatchType() { JWKMatcher matcher = new JWKMatcher.Builder().keyType(KeyType.RSA).build(); assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1").build())); assertFalse(matcher.matches(new ECKey.Builder(ECKey.Curve.P_256, EC_P256_X, EC_P256_Y).keyID("2").build())); assertEquals("kty=RSA", matcher.toString()); }
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 static SAXReader createDefault() { SAXReader reader = new SAXReader(); try { reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); reader.setFeature("http://xml.org/sax/features/external-general-entities", false); reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false); } catch (SAXException e) { // nothing to do, incompatible reader } return reader; }
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 SystemUpdateForm(final SystemUpdatePage parentPage) { super(parentPage); csrfTokenHandler = new CsrfTokenHandler(this); }
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 IESParameterSpec( byte[] derivation, byte[] encoding, int macKeySize, int cipherKeySize) { this(derivation, encoding, macKeySize, cipherKeySize, null, false); }
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 static void validate(final byte[] iv, final int authTagLength) throws JOSEException { if (ByteUtils.safeBitLength(iv) != IV_BIT_LENGTH) { throw new JOSEException(String.format("IV length of %d bits is required, got %d", IV_BIT_LENGTH, ByteUtils.safeBitLength(iv))); } if (authTagLength != AUTH_TAG_BIT_LENGTH) { throw new JOSEException(String.format("Authentication tag length of %d bits is required, got %d", AUTH_TAG_BIT_LENGTH, authTagLength)); } }
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
private String sanitizeTemplate(@Nullable String message) { return escapeExpressions ? escapeMessageParameter(message) : message; }
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
private ModelAndView renameGroup(HttpServletRequest request, HttpServletResponse response) throws Exception { String oldName = request.getParameter("groupName"); String newName = request.getParameter("newName"); if (newName != null && newName.matches(".*[&<>\"`']+.*")) { throw new ServletException("Group ID must not contain any HTML markup."); } if (StringUtils.hasText(oldName) && StringUtils.hasText(newName)) { m_groupRepository.renameGroup(oldName, newName); } return listGroups(request, response); }
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
/*package*/ static Secret tryDecrypt(Cipher cipher, byte[] in) throws UnsupportedEncodingException { try { String plainText = new String(cipher.doFinal(in), "UTF-8"); if(plainText.endsWith(MAGIC)) return new Secret(plainText.substring(0,plainText.length()-MAGIC.length())); return null; } catch (GeneralSecurityException e) { return null; // if the key doesn't match with the bytes, it can result in BadPaddingException } }
0
Java
CWE-326
Inadequate Encryption Strength
The software stores or transmits sensitive data using an encryption scheme that is theoretically sound, but is not strong enough for the level of protection required.
https://cwe.mitre.org/data/definitions/326.html
vulnerable
void setConfigAttributes_shouldUpdatePasswordWhenPasswordChangedBooleanChanged() throws Exception { P4MaterialConfig materialConfig = p4("", ""); materialConfig.setPassword("notSecret"); Map<String, String> map = new HashMap<>(); map.put(P4MaterialConfig.PASSWORD, "secret"); map.put(P4MaterialConfig.PASSWORD_CHANGED, "1"); materialConfig.setConfigAttributes(map); assertThat(ReflectionUtil.getField(materialConfig, "password")).isNull(); assertThat(materialConfig.getPassword()).isEqualTo("secret"); assertThat(materialConfig.getEncryptedPassword()).isEqualTo(new GoCipher().encrypt("secret")); //Dont change map.put(SvnMaterialConfig.PASSWORD, "Hehehe"); map.put(SvnMaterialConfig.PASSWORD_CHANGED, "0"); materialConfig.setConfigAttributes(map); assertThat(ReflectionUtil.getField(materialConfig, "password")).isNull(); assertThat(materialConfig.getPassword()).isEqualTo("secret"); assertThat(materialConfig.getEncryptedPassword()).isEqualTo(new GoCipher().encrypt("secret")); //Dont change map.put(SvnMaterialConfig.PASSWORD, ""); map.put(SvnMaterialConfig.PASSWORD_CHANGED, "1"); materialConfig.setConfigAttributes(map); assertThat(materialConfig.getPassword()).isNull(); assertThat(materialConfig.getEncryptedPassword()).isNull(); }
0
Java
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The software constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public static void testListCompact() throws Exception { TMemoryInputTransport buf = new TMemoryInputTransport(kCompactListEncoding); TProtocol iprot = new TCompactProtocol(buf); testTruncated(new MyListStruct(), iprot); }
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
protected Class<?> getClassForNode(Node node) { Class<?> type = node.getType(); if (type.getAnnotation(Editable.class) != null && !ClassUtils.isConcrete(type)) { ImplementationRegistry registry = OneDev.getInstance(ImplementationRegistry.class); for (Class<?> implementationClass: registry.getImplementations(node.getType())) { String implementationTag = new Tag("!" + implementationClass.getSimpleName()).getValue(); if (implementationTag.equals(node.getTag().getValue())) return implementationClass; } } return super.getClassForNode(node); }
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
private Runnable getStandardRequestSetup() { 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); } }; }
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
static SecretKey deriveSharedSecret(final ECPublicKey publicKey, final ECPrivateKey privateKey, final Provider provider) throws JOSEException { // Get an ECDH key agreement instance from the JCA provider KeyAgreement keyAgreement; try { if (provider != null) { keyAgreement = KeyAgreement.getInstance("ECDH", provider); } else { keyAgreement = KeyAgreement.getInstance("ECDH"); } } catch (NoSuchAlgorithmException e) { throw new JOSEException("Couldn't get an ECDH key agreement instance: " + e.getMessage(), e); } try { keyAgreement.init(privateKey); keyAgreement.doPhase(publicKey, true); } catch (InvalidKeyException e) { throw new JOSEException("Invalid key for ECDH key agreement: " + e.getMessage(), e); } return new SecretKeySpec(keyAgreement.generateSecret(), "AES"); }
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 ASN1Enumerated( byte[] bytes) { if (bytes.length > 1) { if (bytes[0] == 0 && (bytes[1] & 0x80) == 0) { throw new IllegalArgumentException("malformed enumerated"); } if (bytes[0] == (byte)0xff && (bytes[1] & 0x80) != 0) { throw new IllegalArgumentException("malformed enumerated"); } } this.bytes = Arrays.clone(bytes); }
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
void equal() { final PathAndQuery res = PathAndQuery.parse("/=?a=b=1"); assertThat(res).isNotNull(); assertThat(res.path()).isEqualTo("/="); assertThat(res.query()).isEqualTo("a=b=1"); // '%3D' in a query string should never be decoded into '='. final PathAndQuery res2 = PathAndQuery.parse("/%3D?a%3db=1"); assertThat(res2).isNotNull(); assertThat(res2.path()).isEqualTo("/="); assertThat(res2.query()).isEqualTo("a%3Db=1"); }
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 doFilter(ServletRequest srequest, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { /* HttpServletRequest request = (HttpServletRequest) srequest; //final String realIp = request.getHeader(X_FORWARDED_FOR); //if (realIp != null) { filterChain.doFilter(new XssHttpServletRequestWrapper(request) { *//** public String getRemoteAddr() { return realIp; } public String getRemoteHost() { return realIp; } **//* }, response); return; //} */ }
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 void subValidateFail(ViolationCollector col) { col.addViolation(FAILED+"subclass"); }
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 static String malformedHeaderNameMessage(AsciiString name) { final StringBuilder buf = new StringBuilder(IntMath.saturatedAdd(name.length(), 64)); buf.append("malformed header name: "); final int nameLength = name.length(); for (int i = 0; i < nameLength; i++) { final char ch = name.charAt(i); if (PROHIBITED_NAME_CHARS.get(ch)) { buf.append(PROHIBITED_NAME_CHAR_NAMES[ch]); } else { buf.append(ch); } } return buf.toString(); }
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
final void addObject(CharSequence name, Iterable<?> values) { final AsciiString normalizedName = normalizeName(name); requireNonNull(values, "values"); for (Object v : values) { requireNonNullElement(values, v); addObject(normalizedName, v); } }
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
final void setObject(CharSequence name, Object... values) { final AsciiString normalizedName = HttpHeaderNames.of(name); requireNonNull(values, "values"); final int h = normalizedName.hashCode(); final int i = index(h); remove0(h, i, normalizedName); for (Object v: values) { requireNonNullElement(values, v); add0(h, i, normalizedName, fromObject(v)); } }
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 boolean isOriginAllowed(String pOrigin, boolean pIsStrictCheck) { return corsChecker.check(pOrigin,pIsStrictCheck); }
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 Secret decrypt(String data) { if(data==null) return null; try { byte[] in = Base64.decode(data.toCharArray()); Secret s = tryDecrypt(KEY.decrypt(), in); if (s!=null) return s; // try our historical key for backward compatibility Cipher cipher = getCipher("AES"); cipher.init(Cipher.DECRYPT_MODE, getLegacyKey()); return tryDecrypt(cipher, in); } catch (GeneralSecurityException e) { return null; } catch (UnsupportedEncodingException e) { throw new Error(e); // impossible } catch (IOException e) { return null; } }
0
Java
CWE-326
Inadequate Encryption Strength
The software stores or transmits sensitive data using an encryption scheme that is theoretically sound, but is not strong enough for the level of protection required.
https://cwe.mitre.org/data/definitions/326.html
vulnerable
public void headerPlusSignContentLengthValidationShouldPropagateWithEndStream() { headerSignContentLengthValidationShouldPropagateWithEndStream(false, 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
private static boolean isBase64(char ch) { return 0<=ch && ch<128 && IS_BASE64[ch]; }
1
Java
NVD-CWE-noinfo
null
null
null
safe
public void setOrderBy(String orderBy) { orderBy = SQLUtil.sanitizeSortBy(orderBy); this.orderBy = orderBy; }
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 PropertiesRequest getRequestedFields( InputStream in ) { final Set<QName> set = new LinkedHashSet<QName>(); try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); StreamUtils.readTo( in, bout, false, true ); byte[] arr = bout.toByteArray(); if( arr.length > 1 ) { ByteArrayInputStream bin = new ByteArrayInputStream( arr ); XMLReader reader = XMLReaderFactory.createXMLReader(); reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false); PropFindSaxHandler handler = new PropFindSaxHandler(); reader.setContentHandler( handler ); try { reader.parse( new InputSource( bin ) ); if( handler.isAllProp() ) { return new PropertiesRequest(); } else { set.addAll( handler.getAttributes().keySet() ); } } catch( IOException e ) { log.warn( "exception parsing request body", e ); // ignore } catch( SAXException e ) { log.warn( "exception parsing request body", e ); // ignore } } } catch( Exception ex ) { // There's a report of an exception being thrown here by IT Hit Webdav client // Perhaps we can just log the error and return an empty set. Usually this // class is wrapped by the MsPropFindRequestFieldParser which will use a default // set of properties if this returns an empty set log.warn("Exception parsing PROPFIND request fields. Returning empty property set", ex); //throw new RuntimeException( ex ); } return PropertiesRequest.toProperties(set); }
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
void shouldNotDecodeSlash() { final PathAndQuery res = PathAndQuery.parse("%2F?%2F"); // Do not accept a relative path. assertThat(res).isNull(); final PathAndQuery res1 = PathAndQuery.parse("/%2F?%2F"); assertThat(res1).isNotNull(); assertThat(res1.path()).isEqualTo("/%2F"); assertThat(res1.query()).isEqualTo("%2F"); final PathAndQuery pathOnly = PathAndQuery.parse("/foo%2F"); assertThat(pathOnly).isNotNull(); assertThat(pathOnly.path()).isEqualTo("/foo%2F"); assertThat(pathOnly.query()).isNull(); final PathAndQuery queryOnly = PathAndQuery.parse("/?%2f=%2F"); assertThat(queryOnly).isNotNull(); assertThat(queryOnly.path()).isEqualTo("/"); assertThat(queryOnly.query()).isEqualTo("%2F=%2F"); }
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 combinesSafeAndUnsafeSortCorrectly() { JpaSort sort = new JpaSort(path(User_.colleagues).dot(User_.roles).dot(Role_.name)).andUnsafe(DESC, "foo.bar"); assertThat(sort, hasItems(new Order(ASC, "colleagues.roles.name"), new Order(DESC, "foo.bar"))); assertThat(sort.getOrderFor("colleagues.roles.name"), is(not(instanceOf(JpaOrder.class)))); assertThat(sort.getOrderFor("foo.bar"), is(instanceOf(JpaOrder.class))); }
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 void translate(ShowCreditsPacket packet, GeyserSession session) { if (packet.getStatus() == ShowCreditsPacket.Status.END_CREDITS) { 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 SAXReader(String xmlReaderClassName, boolean validating) throws SAXException { if (xmlReaderClassName != null) { this.xmlReader = XMLReaderFactory .createXMLReader(xmlReaderClassName); } 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 FileSelection(UserRequest ureq, String currentContainerRelPath) { if (currentContainerRelPath.equals("/")) currentContainerRelPath = ""; this.currentContainerRelPath = currentContainerRelPath; parse(ureq); }
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
protected static String unifyQuotes( String path ) { if ( path == null ) { return null; } if ( path.indexOf( " " ) == -1 && path.indexOf( "'" ) != -1 && path.indexOf( "\"" ) == -1 ) { return StringUtils.escape( path ); } return StringUtils.quoteAndEscape( path, '\"', BASH_QUOTING_TRIGGER_CHARS ); }
0
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
vulnerable
public void testXmlLoad() throws Exception { File exploitFile = f.newFile(); try { // be extra sure there's no file already if (exploitFile.exists() && !exploitFile.delete()) { throw new IllegalStateException("file exists and cannot be deleted"); } File tempJobDir = new File(j.jenkins.getRootDir(), "security383"); String exploitXml = IOUtils.toString( XStream2Security383Test.class.getResourceAsStream( "/hudson/util/XStream2Security383Test/config.xml"), "UTF-8"); exploitXml = exploitXml.replace("@TOKEN@", exploitFile.getAbsolutePath()); FileUtils.write(new File(tempJobDir, "config.xml"), exploitXml); try { Items.load(j.jenkins, tempJobDir); } catch (Exception e) { // ignore } assertFalse("no file should be created here", exploitFile.exists()); } finally { exploitFile.delete(); } }
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 int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (!haskey) { // The key is not set yet - return the plaintext as-is. if (length > space) throw new ShortBufferException(); if (plaintext != ciphertext || plaintextOffset != ciphertextOffset) System.arraycopy(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length); return length; } if (space < 16 || length > (space - 16)) throw new ShortBufferException(); setup(ad); encrypt(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length); poly.update(ciphertext, ciphertextOffset, length); finish(ad, length); System.arraycopy(polyKey, 0, ciphertext, ciphertextOffset + length, 16); return length + 16; }
0
Java
CWE-787
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
https://cwe.mitre.org/data/definitions/787.html
vulnerable
public void onTurnEnded(TurnEndedEvent event) { super.onTurnEnded(event); final String out = event.getTurnSnapshot().getRobots()[0].getOutputStreamSnapshot(); if (out.contains("access denied (java.net.SocketPermission") || out.contains("access denied (\"java.net.SocketPermission\"")) { messagedAccessDenied = true; } }
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 sort_directory(struct dir *dir) { struct dir_ent *cur, *l1, *l2, *next; int len1, len2, stride = 1; if(dir->dir_count < 2) return; /* * We can consider our linked-list to be made up of stride length * sublists. Eacn iteration around this loop merges adjacent * stride length sublists into larger 2*stride sublists. We stop * when stride becomes equal to the entire list. * * Initially stride = 1 (by definition a sublist of 1 is sorted), and * these 1 element sublists are merged into 2 element sublists, which * are then merged into 4 element sublists and so on. */ do { l2 = dir->dirs; /* head of current linked list */ cur = NULL; /* empty output list */ /* * Iterate through the linked list, merging adjacent sublists. * On each interation l2 points to the next sublist pair to be * merged (if there's only one sublist left this is simply added * to the output list) */ while(l2) { l1 = l2; for(len1 = 0; l2 && len1 < stride; len1 ++, l2 = l2->next); len2 = stride; /* * l1 points to first sublist. * l2 points to second sublist. * Merge them onto the output list */ while(len1 && l2 && len2) { if(strcmp(l1->name, l2->name) <= 0) { next = l1; l1 = l1->next; len1 --; } else { next = l2; l2 = l2->next; len2 --; } if(cur) { cur->next = next; cur = next; } else dir->dirs = cur = next; } /* * One sublist is now empty, copy the other one onto the * output list */ for(; len1; len1 --, l1 = l1->next) { if(cur) { cur->next = l1; cur = l1; } else dir->dirs = cur = l1; } for(; l2 && len2; len2 --, l2 = l2->next) { if(cur) { cur->next = l2; cur = l2; } else dir->dirs = cur = l2; } } cur->next = NULL; stride = stride << 1; } while(stride < dir->dir_count); }
1
Java
CWE-59
Improper Link Resolution Before File Access ('Link Following')
The software attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.
https://cwe.mitre.org/data/definitions/59.html
safe
public void onTurnEnded(TurnEndedEvent event) { super.onTurnEnded(event); final String out = event.getTurnSnapshot().getRobots()[0].getOutputStreamSnapshot(); if (out.contains("SYSTEM: Using socket is not allowed")) { securityExceptionOccurred = true; } }
1
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
safe
public void fireUndeployEvent(HotDeployEvent hotDeployEvent) { for (HotDeployListener hotDeployListener : _hotDeployListeners) { try { hotDeployListener.invokeUndeploy(hotDeployEvent); } catch (HotDeployException hde) { _log.error(hde, hde); } } _deployedServletContextNames.remove( hotDeployEvent.getServletContextName()); ClassLoader classLoader = hotDeployEvent.getContextClassLoader(); TemplateManagerUtil.destroy(classLoader); PACLPolicyManager.unregister(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
public void init( final ServletConfig config ) throws ServletException { final String _includes = config.getInitParameter( "includes-path" ); if ( _includes != null && !_includes.trim().isEmpty() ) { includes.addAll( Arrays.asList( _includes.split( "," ) ) ); } final String _excludes = config.getInitParameter( "excludes-path" ); if ( _excludes != null && !_excludes.trim().isEmpty() ) { excludes.addAll( Arrays.asList( _excludes.split( "," ) ) ); } }
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 String bytesToHex(byte[] bytes, int length) { String out = ""; for (int j = 0; j < length; j++) { int v = bytes[j] & 0xFF; out += hexArray[v >>> 4]; out += hexArray[v & 0x0F]; out += " "; } return out; }
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 byte[] engineGetIV() { if (engineSpec != null) { return engineSpec.getNonce(); } return null; }
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 existingDocumentFromUITemplateProviderSpecifiedNonTerminal() 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); // Mock 1 existing template provider that creates terminal documents. mockExistingTemplateProviders(templateProviderFullName, new DocumentReference("xwiki", Arrays.asList("XWiki"), "MyTemplateProvider"), Collections.EMPTY_LIST, false); // 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 and 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 void testHeaderNameStartsWithControlChar1e() { testHeaderNameStartsWithControlChar(0x1e); }
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 JpaOrder with(NullHandling nullHandling) { return new JpaOrder(getDirection(), getProperty(), nullHandling, isIgnoreCase(), this.unsafe); }
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
private void handle(ServletRequestHandler pReqHandler,HttpServletRequest pReq, HttpServletResponse pResp) throws IOException { JSONAware json = null; try { // Check access policy requestHandler.checkAccess(pReq.getRemoteHost(), pReq.getRemoteAddr(), getOriginOrReferer(pReq)); // 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); } } }
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 HostnameVerificationDeprecatedServer() { }
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 void translate(ServerDisconnectPacket packet, GeyserSession session) { session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); }
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 static String sanitizeInput(String theString) { String retVal = theString; if (retVal != null) { for (int i = 0; i < retVal.length(); i++) { char nextChar = retVal.charAt(i); switch (nextChar) { case '\'': case '"': case '<': case '>': retVal = retVal.replace(nextChar, '_'); } } } return retVal; }
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 void updateSecureSessionFlag() { try { ServletContext context = Jenkins.getInstance().servletContext; Method m; try { m = context.getClass().getMethod("getSessionCookieConfig"); } catch (NoSuchMethodException x) { // 3.0+ LOGGER.log(Level.FINE, "Failed to set secure cookie flag", x); return; } Object sessionCookieConfig = m.invoke(context); // not exposing session cookie to JavaScript to mitigate damage caused by XSS Class scc = Class.forName("javax.servlet.SessionCookieConfig"); Method setHttpOnly = scc.getMethod("setHttpOnly",boolean.class); setHttpOnly.invoke(sessionCookieConfig,true); Method setSecure = scc.getMethod("setSecure",boolean.class); boolean v = fixNull(jenkinsUrl).startsWith("https"); setSecure.invoke(sessionCookieConfig,v); } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to set secure cookie flag", e); } }
0
Java
CWE-254
7PK - Security Features
Software security is not security software. Here we're concerned with topics like authentication, access control, confidentiality, cryptography, and privilege management.
https://cwe.mitre.org/data/definitions/254.html
vulnerable
public SAXReader(String xmlReaderClassName) throws SAXException { if (xmlReaderClassName != null) { this.xmlReader = XMLReaderFactory .createXMLReader(xmlReaderClassName); } }
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 SAXReader(XMLReader xmlReader) { this.xmlReader = xmlReader; }
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
private void verifyRewrite(File dir) throws Exception { File xml = new File(dir, "foo.xml"); Pattern pattern = Pattern.compile("<foo>"+plain_regex_match+"</foo>"); assertTrue(pattern.matcher(FileUtils.readFileToString(xml).trim()).matches()); }
1
Java
CWE-326
Inadequate Encryption Strength
The software stores or transmits sensitive data using an encryption scheme that is theoretically sound, but is not strong enough for the level of protection required.
https://cwe.mitre.org/data/definitions/326.html
safe
static void assertMalformedRequest(Class<?> cls, Object... args) { try { Request request = buildRequest(cls, args); fail("expected a malformed request but was " + request); } catch (IllegalArgumentException expected) { } }
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 newDocumentWebHomeTopLevelFromURL() throws Exception { // new document = xwiki:X.WebHome DocumentReference documentReference = new DocumentReference("xwiki", Arrays.asList("X"), "WebHome"); XWikiDocument document = mock(XWikiDocument.class); when(document.getDocumentReference()).thenReturn(documentReference); when(document.isNew()).thenReturn(true); when(document.getLocalReferenceMaxLength()).thenReturn(255); context.setDoc(document); // 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: The title is not "WebHome", but "X" (the space's name) to avoid exposing "WebHome" in the UI. verify(mockURLFactory).createURL("X", "WebHome", "edit", "template=&parent=Main.WebHome&title=X", 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
protected byte[] engineGetEncoded() { try { ASN1EncodableVector v = new ASN1EncodableVector(); if (currentSpec.getDerivationV() != null) { v.add(new DERTaggedObject(false, 0, new DEROctetString(currentSpec.getDerivationV()))); } if (currentSpec.getEncodingV() != null) { v.add(new DERTaggedObject(false, 1, new DEROctetString(currentSpec.getEncodingV()))); } v.add(new ASN1Integer(currentSpec.getMacKeySize())); if (currentSpec.getNonce() != null) { ASN1EncodableVector cV = new ASN1EncodableVector(); cV.add(new ASN1Integer(currentSpec.getCipherKeySize())); cV.add(new ASN1Integer(currentSpec.getNonce())); v.add(new DERSequence(cV)); } return new DERSequence(v).getEncoded(ASN1Encoding.DER); } catch (IOException e) { throw new RuntimeException("Error encoding IESParameters"); } }
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 write(byte[] b, int offset, int length) throws IOException { if (b == null) { throw new NullPointerException(); } if (offset < 0 || offset + length > b.length) { throw new ArrayIndexOutOfBoundsException(); } write(fd, b, offset, length); }
0
Java
CWE-787
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
https://cwe.mitre.org/data/definitions/787.html
vulnerable
protected void onSubmit() { super.onSubmit(); csrfTokenHandler.onSubmit(); parentPage.refresh(); }
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 testContains() { final HttpHeadersBase headers = newEmptyHeaders(); headers.addLong("long", Long.MAX_VALUE); assertThat(headers.containsLong("long", Long.MAX_VALUE)).isTrue(); assertThat(headers.containsLong("long", Long.MIN_VALUE)).isFalse(); headers.addInt("int", Integer.MIN_VALUE); assertThat(headers.containsInt("int", Integer.MIN_VALUE)).isTrue(); assertThat(headers.containsInt("int", Integer.MAX_VALUE)).isFalse(); headers.addDouble("double", Double.MAX_VALUE); assertThat(headers.containsDouble("double", Double.MAX_VALUE)).isTrue(); assertThat(headers.containsDouble("double", Double.MIN_VALUE)).isFalse(); headers.addFloat("float", Float.MAX_VALUE); assertThat(headers.containsFloat("float", Float.MAX_VALUE)).isTrue(); assertThat(headers.containsFloat("float", Float.MIN_VALUE)).isFalse(); final long millis = System.currentTimeMillis(); headers.addTimeMillis("millis", millis); assertThat(headers.containsTimeMillis("millis", millis)).isTrue(); // This test doesn't work on midnight, January 1, 1970 UTC assertThat(headers.containsTimeMillis("millis", 0)).isFalse(); headers.addObject("object", "Hello World"); assertThat(headers.containsObject("object", "Hello World")).isTrue(); assertThat(headers.containsObject("object", "")).isFalse(); headers.add("name", "value"); assertThat(headers.contains("name", "value")).isTrue(); assertThat(headers.contains("name", "value1")).isFalse(); }
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 String tryRewrite(String s) throws IOException, InvalidKeyException { if (s.length()<24) return s; // Encrypting "" in Secret produces 24-letter characters, so this must be the minimum length if (!isBase64(s)) return s; // decode throws IOException if the input is not base64, and this is also a very quick way to filter byte[] in; try { in = Base64.decode(s.toCharArray()); } catch (IOException e) { return s; // not a valid base64 } cipher.init(Cipher.DECRYPT_MODE, key); Secret sec = Secret.tryDecrypt(cipher, in); if(sec!=null) // matched return sec.getEncryptedValue(); // replace by the new encrypted value else // not encrypted with the legacy key. leave it unmodified return s; }
1
Java
NVD-CWE-noinfo
null
null
null
safe
public void testInvalidUserId(final String userId, final boolean mustFail) { adminPage(); findElementByLink("Configure Users, Groups and On-Call Roles").click(); findElementByLink("Configure Users").click(); findElementByLink("Add new user").click(); enterText(By.id("userID"), userId); enterText(By.id("pass1"), "SmokeTestPassword"); enterText(By.id("pass2"), "SmokeTestPassword"); findElementByXpath("//button[@type='submit' and text()='OK']").click(); if (mustFail) { try { final Alert alert = wait.withTimeout(Duration.of(5, ChronoUnit.SECONDS)).until(ExpectedConditions.alertIsPresent()); alert.dismiss(); } catch (final Exception e) { LOG.debug("Got an exception waiting for a 'invalid user ID' alert.", e); throw e; } } else { wait.until(ExpectedConditions.elementToBeClickable(By.name("finish"))); } }
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 static boolean validateChainData(JsonNode data) throws Exception { ECPublicKey lastKey = null; boolean validChain = false; for (JsonNode node : data) { JWSObject jwt = JWSObject.parse(node.asText()); if (!validChain) { validChain = EncryptionUtils.verifyJwt(jwt, EncryptionUtils.getMojangPublicKey()); } if (lastKey != null) { if (!EncryptionUtils.verifyJwt(jwt, lastKey)) return false; } JsonNode payloadNode = JSON_MAPPER.readTree(jwt.getPayload().toString()); JsonNode ipkNode = payloadNode.get("identityPublicKey"); Preconditions.checkState(ipkNode != null && ipkNode.getNodeType() == JsonNodeType.STRING, "identityPublicKey node is missing in chain"); lastKey = EncryptionUtils.generateKey(ipkNode.asText()); } return validChain; }
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 synchronized MultiMap headers() { if (headers == null) { headers = new VertxHttpHeaders(); } return headers; }
1
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
safe
private Object readResolve() throws ObjectStreamException { if (user != null) { String id = user.getId(); if (id != null) { userId = id; } else { // The user field is not properly deserialized so id may be missing. Look the user up by fullname User user = User.get(this.user.getFullName(), true, Collections.emptyMap()); userId = user.getId(); } this.user = null; } return this; }
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 static Constructor findConstructor(Class clazz) { try { return clazz.getConstructor(); } catch (Exception e) { return null; } }
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 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-378
Creation of Temporary File With Insecure Permissions
Opening temporary files without appropriate measures or controls can leave the file, its contents and any function that it impacts vulnerable to attack.
https://cwe.mitre.org/data/definitions/378.html
safe
private ModelAndView renameGroup(HttpServletRequest request, HttpServletResponse response) throws Exception { String oldName = request.getParameter("groupName"); String newName = request.getParameter("newName"); if (StringUtils.hasText(oldName) && StringUtils.hasText(newName)) { m_groupRepository.renameGroup(oldName, newName); } return listGroups(request, response); }
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 HexStringConfidentialKey(Class owner, String shortName, int length) { this(owner.getName()+'.'+shortName,length); }
1
Java
NVD-CWE-noinfo
null
null
null
safe
public void withRestrictor() throws InvalidSyntaxException, MalformedObjectNameException { setupRestrictor(new InnerRestrictor(true,false,true,false,true,false,true)); assertTrue(restrictor.isHttpMethodAllowed(HttpMethod.GET)); assertFalse(restrictor.isTypeAllowed(RequestType.EXEC)); assertTrue(restrictor.isAttributeReadAllowed(new ObjectName("java.lang:type=Memory"), "HeapMemoryUsage")); assertFalse(restrictor.isAttributeWriteAllowed(new ObjectName("java.lang:type=Memory"), "HeapMemoryUsage")); assertTrue(restrictor.isOperationAllowed(new ObjectName("java.lang:type=Memory"), "gc")); assertFalse(restrictor.isRemoteAccessAllowed("localhost", "127.0.0.1")); assertTrue(restrictor.isCorsAccessAllowed("http://bla.com")); }
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 void addObject(CharSequence name, Object... values) { final AsciiString normalizedName = HttpHeaderNames.of(name); requireNonNull(values, "values"); for (Object v : values) { requireNonNullElement(values, v); addObject(normalizedName, v); } }
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 OldECIESwithDESede() { super(new DESedeEngine()); }
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 void error(SAXParseException e) { }
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
void addShouldIncreaseAndRemoveShouldDecreaseTheSize() { final HttpHeadersBase headers = newEmptyHeaders(); assertThat(headers.size()).isEqualTo(0); headers.add("name1", "value1", "value2"); assertThat(headers.size()).isEqualTo(2); headers.add("name2", "value3", "value4"); assertThat(headers.size()).isEqualTo(4); headers.add("name3", "value5"); assertThat(headers.size()).isEqualTo(5); headers.remove("name3"); assertThat(headers.size()).isEqualTo(4); headers.remove("name1"); assertThat(headers.size()).isEqualTo(2); headers.remove("name2"); assertThat(headers.size()).isEqualTo(0); assertThat(headers.isEmpty()).isTrue(); }
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
BCDHPublicKey( DHPublicKeySpec spec) { this.y = spec.getY(); this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG()); this.dhPublicKey = new DHPublicKeyParameters(y, new DHParameters(spec.getP(), spec.getG())); }
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