Skip to content

Commit

Permalink
Preparing v0.2 Release (#22)
Browse files Browse the repository at this point in the history
* corrected dune linter warnings

* Adjusted maintainer

* Added SCons to dependency list, added CONTRIBUTORS.md

* Set release date of v0.2

* added some spaces

* Pack the core library into the same opam package

* Fix Codacy Issues
  • Loading branch information
Enkelmann authored and tbarabosch committed Jun 26, 2019
1 parent 8c23e10 commit 62021a6
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0.2-dev (2019-XX-XX)
0.2 (2019-06-25)
=====

- Refactoring: Unification of cwe_checker function interface
Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# cwe_checker contributors

- [Thomas Barabosch](https://github.com/tbarabosch)
- Original author

- [Nils-Edvin Enkelmann](https://github.com/Enkelmann)
- Current maintainer

- [Jörg Stucke](https://github.com/jstucke)
- Docker container
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## What is cwe_checker? ##
*cwe_checker* is a suite of tools to detect common bug classes such as use of dangerous functions and simple integer overflows. These bug classes are formally known as [Common Weakness Enumerations](https://cwe.mitre.org/) (CWEs). Its main goal is to aid analysts to quickly find vulnerable code paths.

Its main focus are ELF binaries that are commonly found on Linux and Unix operating systems. *cwe_checker* is built on top of [BAP](https://github.com/BinaryAnalysisPlatform/bap)(Binary Analysis Platform). By using BAP, we are not restricted to one low level instruction set architectures like Intel x86. BAP lifts several of them to one common intermediate represenetation (IR). cwe_checker implements its analyses on this IR. At time of writing, BAP 1.5 supports Intel x86/x64, ARM, MIPS, and PPC amongst others. Hence, this makes *cwe_checker* a valuable tool for firmware analysis.
Its main focus are ELF binaries that are commonly found on Linux and Unix operating systems. *cwe_checker* is built on top of [BAP](https://github.com/BinaryAnalysisPlatform/bap)(Binary Analysis Platform). By using BAP, we are not restricted to one low level instruction set architectures like Intel x86. BAP lifts several of them to one common intermediate representation (IR). cwe_checker implements its analyses on this IR. At time of writing, BAP 1.6 supports Intel x86/x64, ARM, MIPS, and PPC amongst others. Hence, this makes *cwe_checker* a valuable tool for firmware analysis.

*cwe_checker* implements a modular architecture that allows to add new analyses with ease. So far the following analyses are implemented across several BAP plugins:
- [CWE-125](https://cwe.mitre.org/data/definitions/125.html): Out-of-bounds read (via emulation)
Expand All @@ -28,7 +28,7 @@ Its main focus are ELF binaries that are commonly found on Linux and Unix operat
- [CWE-560](https://cwe.mitre.org/data/definitions/560.html): Use of umask() with chmod-style Argument
- [CWE-676](https://cwe.mitre.org/data/definitions/676.html): Use of Potentially Dangerous Function
- [CWE-782](https://cwe.mitre.org/data/definitions/782.html): Exposed IOCTL with Insufficient Access Control
- [CWE-787](https://cwe.mitre.org/data/definitions/787.html): Out-of-bounds Write
- [CWE-787](https://cwe.mitre.org/data/definitions/787.html): Out-of-bounds Write (via emulation)

Please note that some of the above analyses only are partially implemented at the moment. Furthermore, false positives are to be expected due to shortcuts and the nature of static analysis as well as over-approximation.

Expand All @@ -49,23 +49,28 @@ There are several ways to install cwe_checker. The recommended way is to get cwe
Another option is to pull the latest Docker container from [dockerhub](https://hub.docker.com/r/fkiecad/cwe_checker) (`docker pull fkiecad/cwe_checker`).

If you plan to develop cwe_checker, it is recommended to build it using the provided `Makefile`. In this case you must ensure that all dependencies are fulfilled:
- Ocaml 4.05.0
- Opam 2.0.2
- dune >= 1.6
- BAP 1.6 (and its dependencies)
- yojson >= 1.6.0
- alcotest >= 0.8.3
- Sark (latest) for IDA Pro annotations
- pytest >= 3.5.1
- Ocaml 4.05.0
- Opam 2.0.2
- dune >= 1.6
- BAP 1.6 (and its dependencies)
- yojson >= 1.6.0
- alcotest >= 0.8.3 (for tests)
- Sark (latest) for IDA Pro annotations
- pytest >= 3.5.1 (for tests)
- SCons >= 3.0.5 (for tests)

Just run `make all` to compile and register the plugin with BAP. You can run the test suite via `make test`.
## How to use cwe_checker? ##
The usage is straight forward: adjust the `config.json` (if needed) and call BAP with *cwe_checker* as a pass.
``` bash
bap PATH_TO_BINARY --pass=cwe-checker --cwe-checker-config=src/config.json
```
For common use cases you can find some recipes in the recipes folder. These can be run with
The emulation checks can be run with the emulation recipe in the recipes folder.
``` bash
bap PATH_TO_BINARY --recipe=recipes/emulation
```
For other common use cases you can find some recipes in the recipes folder. These can be run with
``` bash
bap PATH_TO_BINARY --recipe=recipes/RECIPE_FOLDER_NAME
```
*cwe_checker* outputs to stdout. This output is parsable (sexep). There is a script `cwe_checker_to_ida` to visualize the results in IDA Pro.
Expand All @@ -81,7 +86,7 @@ This project is partly financed by [German Federal Office for Information Securi
A special thanks goes out to the BAP community (especially the official gitter) for answering questions and discussing solutions.
## License
```
Copyright (C) 2018 - Fraunhofer FKIE (thomas.barabosch@fkie.fraunhofer.de)
Copyright (C) 2018 - Fraunhofer FKIE (firmware-security@fkie.fraunhofer.de)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
Expand Down
3 changes: 1 addition & 2 deletions cwe_checker.opam
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ synopsis: "BAP plugin collection to detect common bug classes"
description: """
cwe_checker is a suite of tools to detect common bug classes such as use of dangerous functions and simple integer overflows. These bug classes are formally known as Common Weakness Enumerations (CWEs).
"""
maintainer: "CWE_checker Team <firmware-security@fkie.fraunhofer.de>"
maintainer: "CWE_checker Team <nils-edvin.enkelmann@fkie.fraunhofer.de>"
authors: [ "Thomas Barabosch <[email protected]>" "Nils-Edvin Enkelmann <[email protected]>" ]
license: "LGPL-3.0"
homepage: "https://github.com/fkie-cad/cwe_checker"
Expand All @@ -19,7 +19,6 @@ depends: [
"alcotest" {>= "0.8.3"}
"core_kernel" {>= "v0.11" & < "v0.12"}
"ppx_jane" {>= "v0.11" & < "v0.12"}
"cwe_checker_core" {= "0.2"}
]
depexts: [
"binutils"
Expand Down
2 changes: 1 addition & 1 deletion src/cwe_checker_core.opam
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ synopsis: "Core library for the cwe_checker package"
description: """
Core library for the cwe_checker suite of tools.
"""
maintainer: "CWE_checker Team <firmware-security@fkie.fraunhofer.de>"
maintainer: "CWE_checker Team <nils-edvin.enkelmann@fkie.fraunhofer.de>"
authors: [ "Thomas Barabosch <[email protected]>" "Nils-Edvin Enkelmann <[email protected]>" ]
license: "LGPL-3.0"
homepage: "https://github.com/fkie-cad/cwe_checker"
Expand Down
1 change: 0 additions & 1 deletion test/unit/checkers/cwe_560_test.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
open Bap.Std
open Core_kernel
open Cwe_checker_core

Expand Down
2 changes: 0 additions & 2 deletions test/unit/checkers/cwe_560_test.mli
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
open Bap.Std
open Core_kernel

val tests: unit Alcotest.test_case list

0 comments on commit 62021a6

Please sign in to comment.