Skip to content

Commit

Permalink
Initial version of the Contrast Security converter (#1268)
Browse files Browse the repository at this point in the history
* Core report walking with no result emit.

* Add clickjacking support

* Fix tests that are broken in appveyor (#1134)

* Properly persist run level property bags (#1136)

* Add additional output for clickjacking and cache control rules.

* Contrast convert work

* Additional contrast work.
  • Loading branch information
Larry Golding authored and michaelcfanning committed Feb 8, 2019
1 parent b52d4b0 commit b5f2d45
Show file tree
Hide file tree
Showing 15 changed files with 6,065 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@
"uri": "file://root/projects/myproject/src/"
}
},
"resources": {
"rules": [
{
"id": "31D4607A-A3FF-447C-908A-CA2BBE4CE4B7",
"shortDescription": {
"text": "Sample abstract text. SQL injection vulnerability."
},
"fullDescription": {
"text": "The quick brown fox jumps over the lazy dog.\nThis section explains the rule in detail."
}
}
]
},
"columnKind": "utf16CodeUnits",
"invocations": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@
"uri": "file:///C:/projects/myproject/src/"
}
},
"resources": {
"rules": [
{
"id": "97A5F38F-524B-4A83-94FA-9387B5265825",
"shortDescription": {
"text": "The function <Replace key=\"EnclosingFunction.name\"/> in <Replace key=\"PrimaryLocation.file\"/> sometimes fails to release a system resource allocated by <Replace key=\"FirstTransitionFunction\"/> on line <Replace key=\"FirstTraceLocation.line\"/>.\r\nThe program can potentially fail to release a system resource."
},
"fullDescription": {
"text": "The program can potentially fail to release a system resource.\r\n\r\nResource leaks have at least two common causes:\r\n\r\n- Error conditions and other exceptional circumstances.\r\n\r\n- Confusion over which part of the program is responsible for releasing the resource.\r\n\r\nIn this case, there are program paths on which the resource allocated in <Replace key=\"FirstTraceLocation.file\"/> at line <Replace key=\"FirstTraceLocation.line\"/> is not released.\r\n\r\nMost unreleased resource issues result in general software reliability problems, but if an attacker can intentionally trigger a resource leak, the attacker may be able to launch a denial of service attack by depleting the resource pool.\r\n\r\n**Example:** Under normal conditions the following code executes a database query, processes the results returned by the database, and closes the allocated `SqlConnection` object. But if an exception occurs while executing the SQL or processing the results, the `SqlConnection` object will not be closed. If this happens often enough, the database will run out of available cursors and not be able to execute any more SQL queries.\r\n\r\n`\n ...\n SqlConnection conn = new SqlConnection(connString);\n SqlCommand cmd = new SqlCommand(queryString);\n cmd.Connection = conn;\n conn.Open();\n SqlDataReader rdr = cmd.ExecuteReader();\n HarvestResults(rdr);\n conn.Connection.Close();\n ...\n`"
}
}
]
},
"columnKind": "utf16CodeUnits",
"invocations": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@
"uri": "file:///C:/projects/myproject/src/"
}
},
"resources": {
"rules": [
{
"id": "31D4607A-A3FF-447C-908A-CA2BBE4CE4B7",
"shortDescription": {
"text": "Sample abstract text. SQL injection vulnerability."
},
"fullDescription": {
"text": "The quick brown fox jumps over the lazy dog.\nThis section explains the rule in detail."
}
},
{
"id": "F7A2423A-1927-40A3-920E-17ADB5430412",
"shortDescription": {
"text": "The function <Replace key=\"EnclosingFunction.name\"/> in <Replace key=\"PrimaryLocation.file\"/> reveals system data or debugging information by calling <Replace key=\"PrimaryCall.name\"/> on line <Replace key=\"PrimaryLocation.line\"/>. The information revealed by <Replace key=\"PrimaryCall.name\"/> could help an adversary form a plan of attack.\r\nRevealing system data or debugging information helps an adversary learn about the system and form a plan of attack."
},
"fullDescription": {
"text": "An information leak occurs when system data or debugging information leaves the program through an output stream or logging function.\r\n\r\nIn this case the data from <Replace key=\"SourceFunction\" link=\"SourceLocation\"/> in <Replace key=\"SourceLocation.file\"/> at line <Replace key=\"SourceLocation.line\"/> leaves the program through <Replace key=\"SinkFunction\" link=\"SinkLocation\"/> in <Replace key=\"SinkLocation.file\"/> at line <Replace key=\"SinkLocation.line\"/>.\r\n\r\n**Example:** The following code constructs a database connection string, uses it to create a new connection to the database, and prints it to the console.\r\n\r\n`\nstring cs=\"database=northwind;server=mySQLServer...\";\nSqlConnection conn=new SqlConnection(cs);\n...\nConsole.Writeline(cs);\n`\r\n\r\nDepending on the system configuration, this information can be dumped to a console, written to a log file, or exposed to a remote user. For example, with scripting mechanisms it is trivial to redirect output information from &quot;Standard error&quot; or &quot;Standard output&quot; into a file or another program. Alternatively the system that the program runs on could have a remote logging mechanism such as a &quot;syslog&quot; server that will send the logs to a remote device. During development you will have no way of knowing where this information may end up being displayed.\r\n\r\nIn some cases the error message tells the attacker precisely what sort of an attack the system is vulnerable to. For example, a database error message can reveal that the application is vulnerable to a SQL injection attack. Other error messages can reveal more oblique clues about the system. In the example above, the leaked information could imply information about the type of operating system, the applications installed on the system, and the amount of care that the administrators have put into configuring the program."
}
}
]
},
"columnKind": "utf16CodeUnits",
"invocations": [
{
Expand Down
1 change: 1 addition & 0 deletions src/Sarif.Converters/BuiltInConverterFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private static Dictionary<string, Lazy<ToolFileConverterBase>> CreateBuiltInConv
CreateConverterRecord<AndroidStudioConverter>(result, ToolFormat.AndroidStudio);
CreateConverterRecord<CppCheckConverter>(result, ToolFormat.CppCheck);
CreateConverterRecord<ClangAnalyzerConverter>(result, ToolFormat.ClangAnalyzer);
CreateConverterRecord<ContrastSecurityConverter>(result, ToolFormat.ContrastSecurity);
CreateConverterRecord<FortifyConverter>(result, ToolFormat.Fortify);
CreateConverterRecord<FortifyFprConverter>(result, ToolFormat.FortifyFpr);
CreateConverterRecord<FxCopConverter>(result, ToolFormat.FxCop);
Expand Down
Loading

0 comments on commit b5f2d45

Please sign in to comment.