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
private JpaOrder(Direction direction, String property, NullHandling nullHandlingHint) { this(direction, property, nullHandlingHint, false, true); }
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 prefixesNonAliasedFunctionCallRelatedSortPropertyWhenSelectClauseContainesAliasedFunctionForDifferentProperty() { String query = "SELECT m.name, AVG(m.price) AS avgPrice FROM Magazine m"; Sort sort = new Sort("name", "avgPrice"); assertThat(applySorting(query, sort, "m"), endsWith("order by m.name asc, avgPrice 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 void testPostJobXml() 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()); when(req.getMethod()).thenReturn("POST"); when(req.getInputStream()).thenReturn(new Stream(IOUtils.toInputStream(exploitXml))); when(req.getContentType()).thenReturn("application/xml"); when(req.getParameter("name")).thenReturn("foo"); try { j.jenkins.doCreateItem(req, rsp); } catch (Exception e) { // don't care } 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 getExpirationTime() { return expirationTime; }
0
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
vulnerable
public String invokeServletAndReturnAsString(String url) { return this.xwiki.invokeServletAndReturnAsString(url, getXWikiContext()); }
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 SAXContentHandler createContentHandler(XMLReader reader) { return new SAXContentHandler(getDocumentFactory(), dispatchHandler); }
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
protected List<EfficiencyStatement> findEfficiencyStatements(IdentityRef identity) { List<EfficiencyStatement> efficiencyStatements = new ArrayList<>(); StringBuilder sb = new StringBuilder(); sb.append("select statement from effstatement as statement") .append(" where statement.identity.key=:identityKey"); List<UserEfficiencyStatementImpl> statements = dbInstance.getCurrentEntityManager() .createQuery(sb.toString(), UserEfficiencyStatementImpl.class) .setParameter("identityKey", identity.getKey()) .getResultList(); for(UserEfficiencyStatementImpl statement:statements) { if(StringHelper.containsNonWhitespace(statement.getStatementXml())) { EfficiencyStatement s = (EfficiencyStatement)xstream.fromXML(statement.getStatementXml()); efficiencyStatements.add(s); } } return efficiencyStatements; }
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
default List<String> getPermissions() { List<String> permissions = new ArrayList<>(); permissions.add("*:*"); permissions.add(this.getName().replace('_', ':')); permissions.add(this.getName().substring(0, this.getName().indexOf('_')) + ":*"); return permissions; };
0
Java
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
public void cleanup() { }
1
Java
CWE-362
Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
The program contains a code sequence that can run concurrently with other code, and the code sequence requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence that is operating concurrently.
https://cwe.mitre.org/data/definitions/362.html
safe
public void complexExample() { assertThat(ConstraintViolations.format(validator.validate(new ComplexExample()))) .containsExactly( " failed1", "p2 failed", "p[3] failed", "p[four] failed"); assertThat(TestLoggerFactory.getAllLoggingEvents()) .isEmpty(); }
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 void populateAuthCacheInAllPeers(AuthorizationContext authContext) throws Throwable { // send a GET request to the ExampleService factory to populate auth cache on each peer. // since factory is not OWNER_SELECTION service, request goes to the specified node. for (VerificationHost peer : this.host.getInProcessHostMap().values()) { peer.setAuthorizationContext(authContext); // based on the role created in test, all users have access to ExampleService this.host.sendAndWaitExpectSuccess( Operation.createGet(UriUtils.buildUri(peer, ExampleService.FACTORY_LINK))); } this.host.waitFor("Timeout waiting for correct auth cache state", () -> checkCacheInAllPeers(authContext.getToken(), true)); }
1
Java
CWE-732
Incorrect Permission Assignment for Critical Resource
The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.
https://cwe.mitre.org/data/definitions/732.html
safe
public <T> T toBean(Class<T> beanClass) { setTag(new Tag(beanClass)); if (getVersion() != null) { try { MigrationHelper.migrate(getVersion(), beanClass.newInstance(), this); removeVersion(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); } } return (T) new OneYaml().construct(this); }
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
TEST(ProtocolSkipTest, SkipInt) { IOBufQueue queue; CompactProtocolWriter writer; writer.setOutput(&queue); writer.writeI32(123); auto buf = queue.move(); CompactProtocolReader reader; reader.setInput(buf.get()); reader.skip(TType::T_I32); }
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 PBEWithAESCBC() { super(new CBCBlockCipher(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
protected byte[] load(ConfidentialKey key) throws IOException { CipherInputStream cis=null; FileInputStream fis=null; try { File f = getFileFor(key); if (!f.exists()) return null; Cipher sym = Secret.getCipher("AES"); sym.init(Cipher.DECRYPT_MODE, masterKey); cis = new CipherInputStream(fis=new FileInputStream(f), sym); byte[] bytes = IOUtils.toByteArray(cis); return verifyMagic(bytes); } catch (GeneralSecurityException e) { throw new IOException2("Failed to persist the key: "+key.getId(),e); } finally { IOUtils.closeQuietly(cis); IOUtils.closeQuietly(fis); } }
1
Java
NVD-CWE-noinfo
null
null
null
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-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
protected String getLike() { return "not " + super.getLike(); }
0
Java
NVD-CWE-noinfo
null
null
null
vulnerable
public EfficiencyStatement getUserEfficiencyStatementByKey(Long key) { String query = "select statement from effstatement as statement where statement.key=:key"; List<UserEfficiencyStatementImpl> statement = dbInstance.getCurrentEntityManager() .createQuery(query, UserEfficiencyStatementImpl.class) .setParameter("key", key) .getResultList(); if(statement.isEmpty() || !StringHelper.containsNonWhitespace(statement.get(0).getStatementXml())) { 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 Template getTemplate( String templateId, String templateContent, String errorTemplateId, String errorTemplateContent, TemplateContextType templateContextType) { if (templateContextType.equals(TemplateContextType.EMPTY)) { return new VelocityTemplate( templateId, templateContent, errorTemplateId, errorTemplateContent, null, _velocityEngine, _templateContextHelper); } else if (templateContextType.equals(TemplateContextType.RESTRICTED)) { return new RestrictedTemplate( new VelocityTemplate( templateId, templateContent, errorTemplateId, errorTemplateContent, _restrictedVelocityContext, _velocityEngine, _templateContextHelper), _templateContextHelper.getRestrictedVariables()); } else if (templateContextType.equals(TemplateContextType.STANDARD)) { return new VelocityTemplate( templateId, templateContent, errorTemplateId, errorTemplateContent, _standardVelocityContext, _velocityEngine, _templateContextHelper); } 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
private void processExtras(Bundle extras) { final String downloadUuid = extras.getString(ConversationsActivity.EXTRA_DOWNLOAD_UUID); final String text = extras.getString(Intent.EXTRA_TEXT); final String nick = extras.getString(ConversationsActivity.EXTRA_NICK); final boolean asQuote = extras.getBoolean(ConversationsActivity.EXTRA_AS_QUOTE); final boolean pm = extras.getBoolean(ConversationsActivity.EXTRA_IS_PRIVATE_MESSAGE, false); final List<Uri> uris = extractUris(extras); if (uris != null && uris.size() > 0) { final List<Uri> cleanedUris = cleanUris(new ArrayList<>(uris)); mediaPreviewAdapter.addMediaPreviews(Attachment.of(getActivity(), cleanedUris)); toggleInputMethod(); return; } if (nick != null) { if (pm) { Jid jid = conversation.getJid(); try { Jid next = Jid.of(jid.getLocal(), jid.getDomain(), nick); privateMessageWith(next); } catch (final IllegalArgumentException ignored) { //do nothing } } else { final MucOptions mucOptions = conversation.getMucOptions(); if (mucOptions.participating() || conversation.getNextCounterpart() != null) { highlightInConference(nick); } } } else { if (text != null && asQuote) { quoteText(text); } else { appendText(text); } } final Message message = downloadUuid == null ? null : conversation.findMessageWithFileAndUuid(downloadUuid); if (message != null) { startDownloadable(message); } }
0
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
vulnerable
public static void unzipFilesToPath(String jarPath, String destinationDir) throws IOException { File file = new File(jarPath); try (JarFile jar = new JarFile(file)) { // fist get all directories, // then make those directory on the destination Path /*for (Enumeration<JarEntry> enums = jar.entries(); enums.hasMoreElements(); ) { JarEntry entry = (JarEntry) enums.nextElement(); String fileName = destinationDir + File.separator + entry.getName(); File f = new File(fileName); if (fileName.endsWith("/")) { f.mkdirs(); } }*/ //now create all files for (Enumeration<JarEntry> enums = jar.entries(); enums.hasMoreElements(); ) { JarEntry entry = enums.nextElement(); String fileName = destinationDir + File.separator + entry.getName(); File f = new File(fileName); if (!f.getCanonicalPath().startsWith(destinationDir)) { System.out.println("Zip Slip exploit detected. Skipping entry " + entry.getName()); continue; } File parent = f.getParentFile(); if (!parent.exists()) { parent.mkdirs(); } if (!fileName.endsWith("/")) { try (InputStream is = jar.getInputStream(entry); FileOutputStream fos = new FileOutputStream(f)) { // write contents of 'is' to 'fos' while (is.available() > 0) { fos.write(is.read()); } } } } } }
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 boolean isIncludeExternalDTDDeclarations() { return includeExternalDTDDeclarations; }
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
protected String getSecretKey() { return Jenkins.getInstance().getSecretKey(); }
0
Java
NVD-CWE-noinfo
null
null
null
vulnerable
public MultiMap add(String name, Iterable<String> values) { HttpUtils.validateHeader(name, values); headers.add(toLowerCase(name), values); return this; }
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
public Argument<Session> argumentType() { return Argument.of(Session.class); }
0
Java
CWE-400
Uncontrolled Resource Consumption
The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.
https://cwe.mitre.org/data/definitions/400.html
vulnerable
public void existingDocumentFromUI() 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 when(mockRequest.getParameter("spaceReference")).thenReturn("X"); when(mockRequest.getParameter("name")).thenReturn("Y"); // 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 X.Y.WebHome since we default to non-terminal documents. verify(mockURLFactory).createURL("X.Y", "WebHome", "edit", "template=&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 AESGMAC() { super(new GMac(new GCMBlockCipher(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
public ECIESwithAESCBC() { super(new CBCBlockCipher(new AESEngine()), 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
public void testSquare() { int COUNT = 1000; for (int i = 0; i < COUNT; ++i) { ECFieldElement x = generateMultiplyInput_Random(); BigInteger X = x.toBigInteger(); BigInteger R = X.multiply(X).mod(Q); ECFieldElement z = x.square(); 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
protected RuntimeException createServletException(Exception e) { return new RuntimeException(e); }
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 SVNAuthentication createSVNAuthentication(String kind) { if(kind.equals(ISVNAuthenticationManager.SSL)) try { SVNSSLAuthentication authentication = new SVNSSLAuthentication( Base64.decode(certificate.getPlainText().toCharArray()), Scrambler.descramble(Secret.toString(password)), false); authentication.setCertificatePath("dummy"); // TODO: remove this JENKINS-19175 workaround return authentication; } catch (IOException e) { throw new Error(e); // can't happen } else return null; // unexpected authentication type }
1
Java
CWE-255
Credentials Management Errors
Weaknesses in this category are related to the management of credentials.
https://cwe.mitre.org/data/definitions/255.html
safe
public static void square(int[] x, int[] zz) { long x_0 = x[0] & M; long zz_1; int c = 0, w; { int i = 3, j = 8; do { long xVal = (x[i--] & M); long p = xVal * xVal; zz[--j] = (c << 31) | (int)(p >>> 33); zz[--j] = (int)(p >>> 1); c = (int)p; } while (i > 0); { long p = x_0 * x_0; zz_1 = ((c << 31) & M) | (p >>> 33); zz[0] = (int)p; c = (int)(p >>> 32) & 1; } } long x_1 = x[1] & M; long zz_2 = zz[2] & M; { zz_1 += x_1 * x_0; w = (int)zz_1; zz[1] = (w << 1) | c; c = w >>> 31; zz_2 += zz_1 >>> 32; } long x_2 = x[2] & M; long zz_3 = zz[3] & M; long zz_4 = zz[4] & M; { zz_2 += x_2 * x_0; w = (int)zz_2; zz[2] = (w << 1) | c; c = w >>> 31; zz_3 += (zz_2 >>> 32) + x_2 * x_1; zz_4 += zz_3 >>> 32; zz_3 &= M; } long x_3 = x[3] & M; long zz_5 = zz[5] & M; long zz_6 = zz[6] & M; { zz_3 += x_3 * x_0; w = (int)zz_3; zz[3] = (w << 1) | c; c = w >>> 31; zz_4 += (zz_3 >>> 32) + x_3 * x_1; zz_5 += (zz_4 >>> 32) + x_3 * x_2; zz_6 += zz_5 >>> 32; zz_5 &= M; } w = (int)zz_4; zz[4] = (w << 1) | c; c = w >>> 31; w = (int)zz_5; zz[5] = (w << 1) | c; c = w >>> 31; w = (int)zz_6; zz[6] = (w << 1) | c; c = w >>> 31; w = zz[7] + (int)(zz_6 >> 32); zz[7] = (w << 1) | c; }
0
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
vulnerable
public static OHttpSessionManager getInstance() { return instance; }
0
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
vulnerable
private void checkCorsGetOrigin(final String in, final String out) throws ServletException, IOException { prepareStandardInitialisation(); StringWriter sw = initRequestResponseMocks( new Runnable() { public void run() { expect(request.getHeader("Origin")).andStubReturn(in); expect(request.getRemoteHost()).andReturn("localhost"); expect(request.getRemoteAddr()).andReturn("127.0.0.1"); expect(request.getRequestURI()).andReturn("/jolokia/"); expect(request.getParameterMap()).andReturn(null); } }, new Runnable() { public void run() { response.setHeader("Access-Control-Allow-Origin", out); response.setHeader("Access-Control-Allow-Credentials","true"); response.setCharacterEncoding("utf-8"); response.setContentType("text/plain"); response.setStatus(200); } } ); expect(request.getPathInfo()).andReturn(HttpTestUtil.HEAP_MEMORY_GET_REQUEST); expect(request.getParameter(ConfigKey.MIME_TYPE.getKeyValue())).andReturn("text/plain"); replay(request, response); servlet.doGet(request, response); servlet.destroy(); }
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 OFB() { super(new BufferedBlockCipher(new OFBBlockCipher(new AESEngine(), 128)), 128); }
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 configure(ICourse course, CourseNode newNode, ModuleConfiguration moduleConfig) { if(displayType != null && (STCourseNodeEditController.CONFIG_VALUE_DISPLAY_TOC.equals(displayType) || STCourseNodeEditController.CONFIG_VALUE_DISPLAY_PEEKVIEW.equals(displayType) || STCourseNodeEditController.CONFIG_VALUE_DISPLAY_FILE.equals(displayType))) { moduleConfig.setStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE, displayType); } if(STCourseNodeEditController.CONFIG_VALUE_DISPLAY_FILE.equals(moduleConfig.getStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE))) { if(in != null && StringHelper.containsNonWhitespace(filename)) { VFSContainer rootContainer = course.getCourseFolderContainer(); VFSLeaf singleFile = (VFSLeaf) rootContainer.resolve("/" + filename); if (singleFile == null) { singleFile = rootContainer.createChildLeaf("/" + filename); } moduleConfig.set(STCourseNodeEditController.CONFIG_KEY_FILE, "/" + filename); OutputStream out = singleFile.getOutputStream(false); FileUtils.copy(in, out); FileUtils.closeSafely(out); FileUtils.closeSafely(in); } else if (StringHelper.containsNonWhitespace(filename)) { VFSContainer rootContainer = course.getCourseFolderContainer(); VFSLeaf singleFile = (VFSLeaf) rootContainer.resolve("/" + filename); if(singleFile != null) { moduleConfig.set(STCourseNodeEditController.CONFIG_KEY_FILE, "/" + filename); } } } }
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 annotatedSubClassExample() throws Exception { assertThat(ConstraintViolations.format(validator.validate(new AnnotatedSubclassExample()))) .containsExactlyInAnyOrder( FAILED_RESULT, FAILED_RESULT+"subclass" ); 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
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 void overridingSubClassExample() throws Exception { assertThat(ConstraintViolations.format(validator.validate(new OverridingExample()))) .isEmpty(); 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
public void testGetShellCommandLineBash() throws Exception { Commandline cmd = new Commandline( new BourneShell() ); cmd.setExecutable( "/bin/echo" ); cmd.addArguments( new String[] { "hello world" } ); String[] shellCommandline = cmd.getShellCommandline(); assertEquals( "Command line size", 3, shellCommandline.length ); assertEquals( "/bin/sh", shellCommandline[0] ); assertEquals( "-c", shellCommandline[1] ); String expectedShellCmd = "/bin/echo \'hello world\'"; if ( Os.isFamily( Os.FAMILY_WINDOWS ) ) { expectedShellCmd = "\\bin\\echo \'hello world\'"; } assertEquals( expectedShellCmd, shellCommandline[2] ); }
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 doesNotPrefixSingleAliasedFunctionCalls() { String query = "SELECT AVG(m.price) AS avgPrice FROM Magazine m"; Sort sort = new Sort("avgPrice"); assertThat(applySorting(query, sort, "m"), endsWith("order by avgPrice 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 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", Util.getDigestOf(jenkins.getSecretKey())); 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); } }
0
Java
NVD-CWE-noinfo
null
null
null
vulnerable
public void testHeaderNameStartsWithControlChar1d() { testHeaderNameStartsWithControlChar(0x1d); }
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 boolean isUserSetupAllowed() { return false; }
1
Java
NVD-CWE-noinfo
null
null
null
safe
public void testLowerFunctionInCondition() { Entity entity = from(Entity.class); OnGoingLogicalCondition condition = condition(lower(entity.getCode())) .like().any("test"); where(condition); Query<Entity> select = select(entity); assertEquals( "select entity_0 from Entity entity_0 where ( lower(entity_0.code) like :function_1 )", select.getQuery()); }
1
Java
NVD-CWE-noinfo
null
null
null
safe
public void toScientificString(StringBuilder result) { assert(!isApproximate); if (isNegative()) { result.append('-'); } if (precision == 0) { result.append("0E+0"); return; } // NOTE: It is not safe to add to lOptPos (aka maxInt) or subtract from // rOptPos (aka -maxFrac) due to overflow. int upperPos = Math.min(precision + scale, lOptPos) - scale - 1; int lowerPos = Math.max(scale, rOptPos) - scale; int p = upperPos; result.append((char) ('0' + getDigitPos(p))); if ((--p) >= lowerPos) { result.append('.'); for (; p >= lowerPos; p--) { result.append((char) ('0' + getDigitPos(p))); } } result.append('E'); int _scale = upperPos + scale; if (_scale == Integer.MIN_VALUE) { result.append("-2147483648"); return; } else if (_scale < 0) { _scale *= -1; result.append('-'); } else { result.append('+'); } if (_scale == 0) { result.append('0'); } int insertIndex = result.length(); while (_scale > 0) { int quot = _scale / 10; int rem = _scale % 10; result.insert(insertIndex, (char) ('0' + rem)); _scale = quot; } }
1
Java
CWE-190
Integer Overflow or Wraparound
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.
https://cwe.mitre.org/data/definitions/190.html
safe
public void testIncludes() { final Collection<String> patterns = new ArrayList<String>() {{ add( "git://**" ); add( "**/repo/**" ); }}; { final Path path = Paths.get( URI.create( "file:///Users/home" ) ); Assert.assertFalse( includes( patterns, path ) ); } { final Path path = Paths.get( URI.create( "git://antpathmatcher" ) ); Assert.assertTrue( includes( patterns, path ) ); } { final Path path = Paths.get( URI.create( "git://master@antpathmatcher" ) ); Assert.assertTrue( includes( patterns, path ) ); } }
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 static int safeBitLength(final byte[] byteArray) throws IntegerOverflowException { if (byteArray == null) { return 0; } else { return safeBitLength(byteArray.length); } }
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 void onSubmit() { super.onSubmit(); csrfTokenHandler.onSubmit(); }
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 boolean isCorsAccessAllowed(String pOrigin) { return corsChecker.check(pOrigin); }
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
public boolean check(String pArg) { return check(pArg,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 testHeaderNameEndsWithControlChar0c() { testHeaderNameEndsWithControlChar(0x0c); }
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 static String serializeToString(final Object payload) throws IOException { final ByteArrayOutputStream bos = new ByteArrayOutputStream(); serializeToStream(bos, payload); String agentData = null; try { agentData = bos.toString("8859_1"); } catch (UnsupportedEncodingException e) { logger.warn("Should always support 8859_1", e); agentData = bos.toString(); } return agentData; }
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
public int getPosition() { if ( realPos == -1 ) { realPos = ( getExecutable() == null ? 0 : 1 ); for ( int i = 0; i < position; i++ ) { Arg arg = (Arg) arguments.elementAt( i ); realPos += arg.getParts().length; } } return realPos; }
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 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 SVNSSHAuthentication createSVNAuthentication(String kind) throws SVNException { if(kind.equals(ISVNAuthenticationManager.SSH)) { try { Channel channel = Channel.current(); String privateKey; if(channel!=null) { // remote privateKey = channel.call(new Callable<String,IOException>() { /** * */ private static final long serialVersionUID = -3088632649290496373L; public String call() throws IOException { return FileUtils.readFileToString(getKeyFile(),"iso-8859-1"); } }); } else { privateKey = FileUtils.readFileToString(getKeyFile(),"iso-8859-1"); } return new SVNSSHAuthentication(userName, privateKey.toCharArray(), Scrambler.descramble(passphrase),-1,false); } catch (IOException e) { throw new SVNException( SVNErrorMessage.create(SVNErrorCode.AUTHN_CREDS_UNAVAILABLE,"Unable to load private key").initCause(e)); } catch (InterruptedException e) { throw new SVNException( SVNErrorMessage.create(SVNErrorCode.AUTHN_CREDS_UNAVAILABLE,"Unable to load private key").initCause(e)); } } else return null; // unknown }
0
Java
CWE-255
Credentials Management Errors
Weaknesses in this category are related to the management of credentials.
https://cwe.mitre.org/data/definitions/255.html
vulnerable
public Object getResourceDataForKey(String key) { Object data = null; String dataString = null; Matcher matcher = DATA_SEPARATOR_PATTERN.matcher(key); if (matcher.find()) { if (log.isDebugEnabled()) { log.debug(Messages.getMessage( Messages.RESTORE_DATA_FROM_RESOURCE_URI_INFO, key, dataString)); } int dataStart = matcher.end(); dataString = key.substring(dataStart); byte[] objectArray = null; byte[] dataArray; try { dataArray = dataString.getBytes("ISO-8859-1"); objectArray = decrypt(dataArray); } catch (UnsupportedEncodingException e1) { // default encoding always presented. } if ("B".equals(matcher.group(1))) { data = objectArray; } else { try { ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream(objectArray)); data = in.readObject(); } catch (StreamCorruptedException e) { log.error(Messages .getMessage(Messages.STREAM_CORRUPTED_ERROR), e); } catch (IOException e) { log.error(Messages .getMessage(Messages.DESERIALIZE_DATA_INPUT_ERROR), e); } catch (ClassNotFoundException e) { log .error( Messages .getMessage(Messages.DATA_CLASS_NOT_FOUND_ERROR), e); } } } return data; }
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
public void testInvalidUserIds() { testInvalidUserId("John<b>Doe</b>",true); testInvalidUserId("Jane'Doe'",true); testInvalidUserId("John&Doe",true); testInvalidUserId("Jane\"\"Doe",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
public void onSubmit() { final String sessionCsrfToken = getCsrfSessionToken(); if (StringUtils.equals(sessionCsrfToken, csrfToken) == false) { log.error("Cross site request forgery alert. csrf token doesn't match! session csrf token=" + sessionCsrfToken + ", posted csrf token=" + csrfToken); throw new InternalErrorException("errorpage.csrfError"); } }
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 Collection<StyleSignatureBasic> toSignatures() { List<StyleSignatureBasic> results = new ArrayList<>(Collections.singletonList(StyleSignatureBasic.empty())); boolean star = false; for (Iterator<String> it = data.iterator(); it.hasNext();) { String s = it.next(); if (s.endsWith("*")) { star = true; s = s.substring(0, s.length() - 1); } final String[] names = s.split(","); final List<StyleSignatureBasic> tmp = new ArrayList<>(); for (StyleSignatureBasic ss : results) for (String name : names) tmp.add(ss.add(name)); results = tmp; } if (star) for (ListIterator<StyleSignatureBasic> it = results.listIterator(); it.hasNext();) { final StyleSignatureBasic tmp = it.next().addStar(); it.set(tmp); } return Collections.unmodifiableCollection(results); }
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 void save(String comment, boolean minorEdit) throws XWikiException { if (hasAccessLevel("edit")) { // If the current author does not have PR don't let it set current user as author of the saved document // since it can lead to right escalation if (hasProgrammingRights()) { saveDocument(comment, minorEdit); } else { saveAsAuthor(comment, minorEdit); } } else { java.lang.Object[] args = {getDefaultEntityReferenceSerializer().serialize(getDocumentReference())}; throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED, "Access denied in edit mode on document {0}", null, args); } }
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
private static void testInvalidHeaders0(String requestStr) { EmbeddedChannel channel = new EmbeddedChannel(new HttpRequestDecoder()); assertTrue(channel.writeInbound(Unpooled.copiedBuffer(requestStr, CharsetUtil.US_ASCII))); HttpRequest request = channel.readInbound(); assertTrue(request.decoderResult().isFailure()); assertTrue(request.decoderResult().cause() instanceof IllegalArgumentException); assertFalse(channel.finish()); }
0
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
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()).andReturn(context).anyTimes(); expect(config.getServletName()).andReturn("jolokia").anyTimes(); 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().anyTimes(); context.log(find("TestDetector"),isA(RuntimeException.class)); }
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
private ByteArrayOutputStream initRequestResponseMocks(String callback,Runnable requestSetup,Runnable responseSetup) throws IOException { request = createMock(HttpServletRequest.class); response = createMock(HttpServletResponse.class); setNoCacheHeaders(response); expect(request.getParameter(ConfigKey.CALLBACK.getKeyValue())).andReturn(callback).anyTimes(); requestSetup.run(); responseSetup.run(); class MyServletOutputStream extends ServletOutputStream { ByteArrayOutputStream baos; public void write(int b) throws IOException { baos.write(b); } public void setBaos(ByteArrayOutputStream baos){ this.baos = baos; } } ByteArrayOutputStream baos = new ByteArrayOutputStream(); MyServletOutputStream sos = new MyServletOutputStream(); sos.setBaos(baos); expect(response.getOutputStream()).andReturn(sos); return baos; }
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 testGetChunk() throws Exception { TestHttpData test = new TestHttpData("test", UTF_8, 0); try { File tmpFile = PlatformDependent.createTempFile(UUID.randomUUID().toString(), ".tmp", null); tmpFile.deleteOnExit(); FileOutputStream fos = new FileOutputStream(tmpFile); byte[] bytes = new byte[4096]; PlatformDependent.threadLocalRandom().nextBytes(bytes); try { fos.write(bytes); fos.flush(); } finally { fos.close(); } test.setContent(tmpFile); ByteBuf buf1 = test.getChunk(1024); assertEquals(buf1.readerIndex(), 0); assertEquals(buf1.writerIndex(), 1024); ByteBuf buf2 = test.getChunk(1024); assertEquals(buf2.readerIndex(), 0); assertEquals(buf2.writerIndex(), 1024); assertFalse("Arrays should not be equal", Arrays.equals(ByteBufUtil.getBytes(buf1), ByteBufUtil.getBytes(buf2))); } finally { test.delete(); } }
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
void validSave() throws Exception { 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(""); 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
void getWithDefaultValueWorks() { final HttpHeadersBase headers = newEmptyHeaders(); headers.add("name1", "value1"); assertThat(headers.get("name1", "defaultvalue")).isEqualTo("value1"); assertThat(headers.get("noname", "defaultvalue")).isEqualTo("defaultvalue"); }
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 testGetShellCommandLineBash_WithSingleQuotedArg() throws Exception { Commandline cmd = new Commandline( new BourneShell() ); cmd.setExecutable( "/bin/echo" ); cmd.addArguments( new String[] { "\'hello world\'" } ); String[] shellCommandline = cmd.getShellCommandline(); assertEquals( "Command line size", 3, shellCommandline.length ); assertEquals( "/bin/sh", shellCommandline[0] ); assertEquals( "-c", shellCommandline[1] ); String expectedShellCmd = "/bin/echo \'hello world\'"; if ( Os.isFamily( Os.FAMILY_WINDOWS ) ) { expectedShellCmd = "\\bin\\echo \'hello world\'"; } assertEquals( expectedShellCmd, shellCommandline[2] ); }
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 Document read(File file) throws DocumentException { try { /* * We cannot convert the file to an URL because if the filename * contains '#' characters, there will be problems with the URL in * the InputSource (because a URL like * http://myhost.com/index#anchor is treated the same as * http://myhost.com/index) Thanks to Christian Oetterli */ InputSource source = new InputSource(new FileInputStream(file)); if (this.encoding != null) { source.setEncoding(this.encoding); } String path = file.getAbsolutePath(); if (path != null) { // Code taken from Ant FileUtils StringBuffer sb = new StringBuffer("file://"); // add an extra slash for filesystems with drive-specifiers if (!path.startsWith(File.separator)) { sb.append("/"); } path = path.replace('\\', '/'); sb.append(path); source.setSystemId(sb.toString()); } return read(source); } catch (FileNotFoundException e) { throw new DocumentException(e.getMessage(), 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
public static void beginRequest() { // if the previous request was not ended properly for some reason, make sure it is ended now endRequest(); CACHE.set(new LinkedList<RequestScopedItem>()); }
1
Java
CWE-362
Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
The program contains a code sequence that can run concurrently with other code, and the code sequence requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence that is operating concurrently.
https://cwe.mitre.org/data/definitions/362.html
safe
public void testBasicExceptions() throws IOException, ClassNotFoundException { ShardId id = new ShardId("foo", 1); DiscoveryNode src = new DiscoveryNode("someNode", new InetSocketTransportAddress("127.0.0.1", 6666), Version.CURRENT); DiscoveryNode target = new DiscoveryNode("otherNode", new InetSocketTransportAddress("127.0.0.1", 8888), Version.CURRENT); RecoveryFailedException ex = new RecoveryFailedException(id, src, target, new AlreadyClosedException("closed", new SecurityException("booom booom boom", new FileNotFoundException("no such file")))); RecoveryFailedException serialize = serialize(ex); assertEquals(ex.getMessage(), serialize.getMessage()); assertEquals(AlreadyClosedException.class, serialize.getCause().getClass()); assertEquals(SecurityException.class, serialize.getCause().getCause().getClass()); assertEquals(FileNotFoundException.class, serialize.getCause().getCause().getCause().getClass()); ConnectTransportException tpEx = new ConnectTransportException(src, "foo", new IllegalArgumentException("boom")); ConnectTransportException serializeTpEx = serialize(tpEx); assertEquals(tpEx.getMessage(), serializeTpEx.getMessage()); assertEquals(src, tpEx.node()); TestException testException = new TestException(Arrays.asList("foo"), EnumSet.allOf(IndexShardState.class), ImmutableMap.<String,String>builder().put("foo", "bar").build(), InetAddress.getByName("localhost"), new Number[] {new Integer(1)}); assertEquals(serialize(testException).list.get(0), "foo"); assertTrue(serialize(testException).set.containsAll(Arrays.asList(IndexShardState.values()))); assertEquals(serialize(testException).map.get("foo"), "bar"); }
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 translate(ServerPlayerActionAckPacket packet, GeyserSession session) { ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition()); if (packet.getAction() == PlayerAction.START_DIGGING && !packet.isSuccessful()) { LevelEventPacket stopBreak = new LevelEventPacket(); stopBreak.setType(LevelEventType.BLOCK_STOP_BREAK); stopBreak.setPosition(Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); stopBreak.setData(0); session.setBreakingBlock(BlockStateValues.JAVA_AIR_ID); session.sendUpstreamPacket(stopBreak); } }
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 addViolation(String propertyName, Integer index, String message, Map<String, Object> messageParameters) { violationOccurred = true; getContextWithMessageParameters(messageParameters) .buildConstraintViolationWithTemplate(sanitizeTemplate(message)) .addPropertyNode(propertyName) .addBeanNode().inIterable().atIndex(index) .addConstraintViolation(); }
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 onTurnEnded(TurnEndedEvent event) { super.onTurnEnded(event); final String out = event.getTurnSnapshot().getRobots()[0].getOutputStreamSnapshot(); if (out.contains("java.lang.SecurityException:")) { 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 static void startServers() throws Exception { System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); assertTrue( "Server failed to launch", // run the server in the same process // set this to false to fork launchServer(HostnameVerificationDeprecatedServer.class, true) ); }
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 RainbowParameters(int[] vi) { this.vi = vi; try { checkParams(); } catch (Exception e) { e.printStackTrace(); } }
0
Java
CWE-470
Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')
The application uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code.
https://cwe.mitre.org/data/definitions/470.html
vulnerable
public void testWhereWithNotLikeFunction() { Entity from = from(Entity.class); where(lower(from.getCode())).notLike("%test%"); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 where lower(entity_0.code) not like '%test%'", select.getQuery()); }
0
Java
NVD-CWE-noinfo
null
null
null
vulnerable
public void testMatchUseNotSpecifiedOrSignature() { JWKMatcher matcher = new JWKMatcher.Builder().keyUses(KeyUse.SIGNATURE, null).build(); assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1").keyUse(KeyUse.SIGNATURE).build())); assertTrue(matcher.matches(new ECKey.Builder(ECKey.Curve.P_256, EC_P256_X, EC_P256_Y).keyID("2").build())); assertFalse(matcher.matches(new ECKey.Builder(ECKey.Curve.P_256, EC_P256_X, EC_P256_Y).keyID("3").keyUse(KeyUse.ENCRYPTION).build())); assertEquals("use=[sig, null]", 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 Namespace(String prefix, String uri) { this.prefix = (prefix != null) ? prefix : ""; this.uri = (uri != null) ? uri : ""; if (!this.prefix.isEmpty()) { QName.validateNCName(this.prefix); } }
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
private static void validateQName(String qname) { if (!RE_QNAME.matcher(qname).matches()) { throw new IllegalArgumentException(String.format("Illegal character in qualified name: '%s'.", qname)); } }
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 headersContentLengthMissmatch() throws Exception { headersContentLength(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
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { Integer sc = (Integer) request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE); String msg = (String) request.getAttribute(RequestDispatcher.ERROR_MESSAGE); Throwable err = (Throwable) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); if (err != null) { err.printStackTrace(pw); } else { pw.println("(none)"); } pw.flush(); // If we are here there was no error servlet, so show the default error page String output = Launcher.RESOURCES.getString("WinstoneResponse.ErrorPage", new String[] { sc + "", URIUtil.htmlEscape(msg == null ? "" : msg), URIUtil.htmlEscape(sw.toString()), Launcher.RESOURCES.getString("ServerVersion"), "" + new Date() }); response.setContentLength(output.getBytes(response.getCharacterEncoding()).length); Writer out = response.getWriter(); out.write(output); out.flush(); }
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 Secret decrypt(String data) { if(data==null) return null; try { Cipher cipher = getCipher("AES"); cipher.init(Cipher.DECRYPT_MODE, getKey()); String plainText = new String(cipher.doFinal(Base64.decode(data.toCharArray())), "UTF-8"); if(plainText.endsWith(MAGIC)) return new Secret(plainText.substring(0,plainText.length()-MAGIC.length())); return null; } catch (GeneralSecurityException e) { return null; } catch (UnsupportedEncodingException e) { throw new Error(e); // impossible } catch (IOException e) { return null; } }
0
Java
NVD-CWE-noinfo
null
null
null
vulnerable
public void setStringInternEnabled(boolean stringInternEnabled) { this.stringInternEnabled = stringInternEnabled; }
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 nullHeaderNameNotAllowed() { newEmptyHeaders().add(null, "foo"); }
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
public RFC3211Wrap() { super(new RFC3211WrapEngine(new AESFastEngine()), 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 void testSelectByTwoTypes() { JWKSelector selector = new JWKSelector(new JWKMatcher.Builder().keyTypes(KeyType.RSA, KeyType.EC).build()); List<JWK> keyList = new ArrayList<>(); keyList.add(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1").build()); keyList.add(new ECKey.Builder(ECKey.Curve.P_256, EC_P256_X, EC_P256_Y).keyID("2").build()); JWKSet jwkSet = new JWKSet(keyList); List<JWK> matches = selector.select(jwkSet); RSAKey key1 = (RSAKey)matches.get(0); assertEquals(KeyType.RSA, key1.getKeyType()); assertEquals("1", key1.getKeyID()); ECKey key2 = (ECKey)matches.get(1); assertEquals(KeyType.EC, key2.getKeyType()); assertEquals("2", key2.getKeyID()); assertEquals(2, matches.size()); }
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 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(); }
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
protected void onSubmit() { super.onSubmit(); csrfTokenHandler.onSubmit(); }
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 testCycle_ECDH_ES_Curve_P256_attackPoint1() throws Exception { ECKey ecJWK = generateECJWK(ECKey.Curve.P_256); BigInteger privateReceiverKey = ecJWK.toECPrivateKey().getS(); JWEHeader header = new JWEHeader.Builder(JWEAlgorithm.ECDH_ES, EncryptionMethod.A128GCM) .agreementPartyUInfo(Base64URL.encode("Alice")) .agreementPartyVInfo(Base64URL.encode("Bob")) .build(); // attacking point #1 with order 113 // BigInteger attackerOrderGroup1 = new BigInteger("113"); BigInteger receiverPrivateKeyModAttackerOrderGroup1 = privateReceiverKey .mod(attackerOrderGroup1); // System.out.println("The receiver private key is equal to " // + receiverPrivateKeyModAttackerOrderGroup1 + " mod " // + attackerOrderGroup1); // The malicious JWE contains a public key with order 113 String maliciousJWE1 = "eyJhbGciOiJFQ0RILUVTK0ExMjhLVyIsImVuYyI6IkExMjhDQkMtSFMyNTYiLCJlcGsiOnsia3R5IjoiRUMiLCJ4IjoiZ1RsaTY1ZVRRN3otQmgxNDdmZjhLM203azJVaURpRzJMcFlrV0FhRkpDYyIsInkiOiJjTEFuakthNGJ6akQ3REpWUHdhOUVQclJ6TUc3ck9OZ3NpVUQta2YzMEZzIiwiY3J2IjoiUC0yNTYifX0.qGAdxtEnrV_3zbIxU2ZKrMWcejNltjA_dtefBFnRh9A2z9cNIqYRWg.pEA5kX304PMCOmFSKX_cEg.a9fwUrx2JXi1OnWEMOmZhXd94-bEGCH9xxRwqcGuG2AMo-AwHoljdsH5C_kcTqlXS5p51OB1tvgQcMwB5rpTxg.72CHiYFecyDvuUa43KKT6w"; JWEObject jweObject1 = JWEObject.parse(maliciousJWE1); ECDHDecrypter decrypter = new ECDHDecrypter(ecJWK.toECPrivateKey()); // decrypter.getJCAContext().setKeyEncryptionProvider(BouncyCastleProviderSingleton.getInstance()); try { jweObject1.decrypt(decrypter); fail(); } catch (JOSEException e) { assertEquals("Invalid ephemeral public key: Point not on expected curve", e.getMessage()); } // this proof that receiverPrivateKey is equals 26 % 113 // assertEquals("Gambling is illegal at Bushwood sir, and I never slice.", // jweObject1.getPayload().toString()); // THIS CAN BE DOIN MANY TIME // .... // AND THAN CHINESE REMAINDER THEOREM FTW }
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
void percent() { final PathAndQuery res = PathAndQuery.parse("/%25"); assertThat(res).isNotNull(); assertThat(res.path()).isEqualTo("/%25"); assertThat(res.query()).isNull(); }
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 copyResource(File file, String filename, File targetDirectory, PathMatcher filter) { try { Path path = getResource(file, filename); if(path == null) { return false; } Path destDir = targetDirectory.toPath(); Files.walkFileTree(path, new CopyVisitor(path, destDir, filter)); PathUtils.closeSubsequentFS(path); return true; } catch (IOException e) { log.error("", e); return false; } }
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 byte[] decrypt(final JWEHeader header, final Base64URL encryptedKey, final Base64URL iv, final Base64URL cipherText, final Base64URL authTag) throws JOSEException { final JWEAlgorithm alg = header.getAlgorithm(); final ECDH.AlgorithmMode algMode = ECDH.resolveAlgorithmMode(alg); critPolicy.ensureHeaderPasses(header); // Get ephemeral EC key ECKey ephemeralKey = header.getEphemeralPublicKey(); if (ephemeralKey == null) { throw new JOSEException("Missing ephemeral public EC key \"epk\" JWE header parameter"); } ECPublicKey ephemeralPublicKey = ephemeralKey.toECPublicKey(); // Curve check if (! ECChecks.isPointOnCurve(ephemeralPublicKey, getPrivateKey())) { throw new JOSEException("Invalid ephemeral public EC key: Point(s) not on the expected curve"); } // Derive 'Z' SecretKey Z = ECDH.deriveSharedSecret( ephemeralPublicKey, privateKey, getJCAContext().getKeyEncryptionProvider()); // Derive shared key via concat KDF getConcatKDF().getJCAContext().setProvider(getJCAContext().getMACProvider()); // update before concat SecretKey sharedKey = ECDH.deriveSharedKey(header, Z, getConcatKDF()); final SecretKey cek; if (algMode.equals(ECDH.AlgorithmMode.DIRECT)) { cek = sharedKey; } else if (algMode.equals(ECDH.AlgorithmMode.KW)) { if (encryptedKey == null) { throw new JOSEException("Missing JWE encrypted key"); } cek = AESKW.unwrapCEK(sharedKey, encryptedKey.decode(), getJCAContext().getKeyEncryptionProvider()); } else { throw new JOSEException("Unexpected JWE ECDH algorithm mode: " + algMode); } return ContentCryptoProvider.decrypt(header, encryptedKey, iv, cipherText, authTag, cek, getJCAContext()); }
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 String createQueryFragment(AtomicInteger incrementor) { return selector.createQueryFragment(incrementor) + " " + getLike() + " '" + type.wrap(toMatch) + "' "; }
0
Java
NVD-CWE-noinfo
null
null
null
vulnerable
private void writeResponse(HttpServletResponse response, String ok) throws IOException { response.setContentType("text/html"); response.getWriter().write(ok); }
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 resetForTest() { if (Main.isUnitTest) { this.secret = null; } else { throw new IllegalStateException("Only for testing"); } }
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
public void testInvalidGroupId(final String groupId, final boolean mustFail) { adminPage(); findElementByLink("Configure Users, Groups and On-Call Roles").click(); findElementByLink("Configure Groups").click(); findElementByLink("Add new group").click(); enterText(By.id("groupName"), groupId); enterText(By.id("groupComment"), "SmokeTestComment"); 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 group 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 ByteArrayOutputStream initRequestResponseMocks(String callback,Runnable requestSetup,Runnable responseSetup) throws IOException { request = createMock(HttpServletRequest.class); response = createMock(HttpServletResponse.class); setNoCacheHeaders(response); expect(request.getParameter(ConfigKey.CALLBACK.getKeyValue())).andReturn(callback); requestSetup.run(); responseSetup.run(); class MyServletOutputStream extends ServletOutputStream { ByteArrayOutputStream baos; public void write(int b) throws IOException { baos.write(b); } public void setBaos(ByteArrayOutputStream baos){ this.baos = baos; } } ByteArrayOutputStream baos = new ByteArrayOutputStream(); MyServletOutputStream sos = new MyServletOutputStream(); sos.setBaos(baos); expect(response.getOutputStream()).andReturn(sos); return baos; }
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 contextInitialized(ServletContextEvent sce) { try { configManager.init(); } catch (Exception e) { throw createServletException(e); } sce.getServletContext().setAttribute("ConfigManager", configManager); }
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 boolean isRewriterActive() { return rekeyThread !=null && rekeyThread.isAlive(); }
1
Java
NVD-CWE-noinfo
null
null
null
safe