Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findsecubs cycle #5

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions findsecbugs/console.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
C:\Users\uzair\Downloads\findsecbugs-cli-1.12.0\findsecbugs.bat -progress -html -output report.htm -onlyAnalyze org.apache.commons.csv.* commons-csv-1.11.1-SNAPSHOT.jar
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
Scanning archives (1 / 1)
2 analysis passes to perform
Pass 1: Analyzing classes (110 / 110) - 100% complete
Pass 2: Analyzing classes (18 / 18) - 100% complete
Done with analysis
223 changes: 223 additions & 0 deletions findsecbugs/report.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<title>SpotBugs Report</title>
<style type="text/css">
.tablerow0 {
background: #EEEEEE;
}

.tablerow1 {
background: white;
}

.detailrow0 {
background: #EEEEEE;
}

.detailrow1 {
background: white;
}

.tableheader {
background: #b9b9fe;
font-size: larger;
}

.tablerow0:hover, .tablerow1:hover {
background: #aaffaa;
}

.priority-1 {
color: red;
font-weight: bold;
}
.priority-2 {
color: orange;
font-weight: bold;
}
.priority-3 {
color: green;
font-weight: bold;
}
.priority-4 {
color: blue;
font-weight: bold;
}
</style>
<script type="text/javascript">
function toggleRow(elid) {
if (document.getElementById) {
element = document.getElementById(elid);
if (element) {
if (element.style.display == 'none') {
element.style.display = 'block';
//window.status = 'Toggle on!';
} else {
element.style.display = 'none';
//window.status = 'Toggle off!';
}
}
}
}
</script>
</head>
<body>
<h1>
<a href="https://spotbugs.github.io/">SpotBugs</a> Report</h1>
<h2>Project Information</h2>
<p>Project:
</p>
<p>SpotBugs version: 4.6.0</p>
<p>Code analyzed:</p>
<ul>
<li>commons-csv-1.11.1-SNAPSHOT.jar</li>
</ul>
<p>
<br/>
<br/>
</p>
<h2>Metrics</h2>
<p>1687 lines of code analyzed,
in 18 classes,
in 1 packages.</p>
<table width="500" cellpadding="5" cellspacing="2">
<tr class="tableheader">
<th align="left">Metric</th>
<th align="right">Total</th>
<th align="right">Density*</th>
</tr>
<tr class="tablerow0">
<td>High Priority Warnings</td>
<td align="right"/>
<td align="right">0.00</td>
</tr>
<tr class="tablerow1">
<td>Medium Priority Warnings</td>
<td align="right">1</td>
<td align="right">0.59</td>
</tr>
<tr class="$totalClass">
<td>
<b>Total Warnings</b>
</td>
<td align="right">
<b>1</b>
</td>
<td align="right">
<b>0.59</b>
</td>
</tr>
</table>
<p>
<i>(* Defects per Thousand lines of non-commenting source statements)</i>
</p>
<p>
<br/>
<br/>
</p>
<h2>Contents</h2>
<ul>
<li>
<a href="#Warnings_SECURITY">Security Warnings</a>
</li>
<li>
<a href="#Details">Details</a>
</li>
</ul>
<h1>Summary</h1>
<table width="500" cellpadding="5" cellspacing="2">
<tr class="tableheader">
<th align="left">Warning Type</th>
<th align="right">Number</th>
</tr>
<tr class="tablerow0">
<td>
<a href="#Warnings_SECURITY">Security Warnings</a>
</td>
<td align="right">1</td>
</tr>
<tr class="tablerow1">
<td>
<b>Total</b>
</td>
<td align="right">
<b>1</b>
</td>
</tr>
</table>
<h1>Warnings</h1>
<p>Click on a warning row to see full context information.</p>
<h2>
<a name="Warnings_SECURITY">Security Warnings</a>
</h2>
<table class="warningtable" width="100%" cellspacing="0">
<tr class="tableheader">
<th align="left">Code</th>
<th align="left">Warning</th>
</tr>
<tr class="tablerow1" onclick="toggleRow('d1e5');">
<td>
<span class="priority-2">SECSSSRFUC</span>
</td>
<td>This web server request could be used by an attacker to expose internal services and filesystem.</td>
</tr>
<tr class="detailrow1">
<td/>
<td>
<p id="d1e5" style="display: none;">
<a href="#URLCONNECTION_SSRF_FD">Bug type URLCONNECTION_SSRF_FD (click for details)</a>
<br/>In class org.apache.commons.csv.CSVParser<br/>In method org.apache.commons.csv.CSVParser.parse(URL, Charset, CSVFormat)<br/>At CSVParser.java:[line 351]<br/>Sink method java/net/URL.openStream()Ljava/io/InputStream;<br/>Sink parameter 0<br/>Unknown source org/apache/commons/csv/CSVParser.parse(Ljava/net/URL;Ljava/nio/charset/Charset;Lorg/apache/commons/csv/CSVFormat;)Lorg/apache/commons/csv/CSVParser; parameter 2<br/>Method usage not detected<br/>At CSVParser.java:[line 347]</p>
</td>
</tr>
</table>
<h1>
<a name="Details">Details</a>
</h1>
<h2>
<a name="URLCONNECTION_SSRF_FD">URLCONNECTION_SSRF_FD: URLConnection Server-Side Request Forgery (SSRF) and File Disclosure</a>
</h2>

<p>
Server-Side Request Forgery occur when a web server executes a request to a user supplied destination
parameter that is not validated. Such vulnerabilities could allow an attacker to access internal services
or to launch attacks from your web server.
</p>
<p>
URLConnection can be used with file:// protocol or other protocols to access local filesystem and potentially other services.
<p>
<b>Vulnerable Code:</b>
<pre>
new URL(String url).openConnection()
</pre>

<pre>
new URL(String url).openStream()
</pre>

<pre>
new URL(String url).getContent()
</pre>
</p>
<p>
<b>Solution/Countermeasures:</b><br/>
<ul>
<li>Don't accept URL destinations from users</li>
<li>Accept a destination key, and use it to look up the target destination associate with the key</li>
<li>White list URLs (if possible)</li>
<li>Validate that the beginning of the URL is part of a white list</li>
</ul>
</p>
<br/>
<p>
<b>References</b><br/>
<a href="https://cwe.mitre.org/data/definitions/918.html">CWE-918: Server-Side Request Forgery (SSRF)</a><br/>
<a href="https://www.bishopfox.com/blog/2015/04/vulnerable-by-design-understanding-server-side-request-forgery/">Understanding Server-Side Request Forgery</a><br/>
<a href="https://cwe.mitre.org/data/definitions/73.html">CWE-73: External Control of File Name or Path</a><br/>
<a href="https://www.pwntester.com/blog/2013/11/28/abusing-jar-downloads/">Abusing jar:// downloads</a><br />
</p>
</body>
</html>
Binary file added findsecbugs/ss1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.