All Projects → CROSSINGTUD → Cryptoanalysis

CROSSINGTUD / Cryptoanalysis

Licence: epl-2.0
CogniCrypt_SAST: CrySL-to-Static Analysis Compiler

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Cryptoanalysis

Checkstyle
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Google Java Style Guide and Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.
Stars: ✭ 6,481 (+17902.78%)
Mutual labels:  command-line-tool, static-analysis
Cognicrypt
CogniCrypt is an Eclipse plugin that supports Java developers in using Java Cryptographic APIs.
Stars: ✭ 50 (+38.89%)
Mutual labels:  static-analysis, cryptography
Stdrename
'stdrename' is a small command line utility to rename all files in a folder according to a specified naming convention (camelCase, snake_case, kebab-case, etc.).
Stars: ✭ 28 (-22.22%)
Mutual labels:  command-line-tool
Google Images Download
Python Script to download hundreds of images from 'Google Images'. It is a ready-to-run code!
Stars: ✭ 7,815 (+21608.33%)
Mutual labels:  command-line-tool
Cl Tls
An implementation of TLS and related specifications in Common Lisp
Stars: ✭ 32 (-11.11%)
Mutual labels:  cryptography
Supergirloncrypt
CryptoTrojan in Python (For educational purpose ONLY)
Stars: ✭ 28 (-22.22%)
Mutual labels:  cryptography
Nim Libsodium
Nim wrapper for the libsodium library
Stars: ✭ 32 (-11.11%)
Mutual labels:  cryptography
Pm2
Node.js Production Process Manager with a built-in Load Balancer.
Stars: ✭ 36,126 (+100250%)
Mutual labels:  command-line-tool
Moviescore
A cli tool to get movie ratings and reviews directly to your terminal!
Stars: ✭ 35 (-2.78%)
Mutual labels:  command-line-tool
Powersoftau
An independent implementation of the Powers of Tau MPC ceremony.
Stars: ✭ 32 (-11.11%)
Mutual labels:  cryptography
Endpointfinder
Stars: ✭ 34 (-5.56%)
Mutual labels:  static-analysis
Datasafe
Datasafe - flexible and secure data storage and document sharing using cryptographic message syntax for data encryption
Stars: ✭ 32 (-11.11%)
Mutual labels:  cryptography
Lethean Vpn
Lethean Virtual Private Network (VPN)
Stars: ✭ 29 (-19.44%)
Mutual labels:  cryptography
Env Cmd
Setting environment variables from a file
Stars: ✭ 969 (+2591.67%)
Mutual labels:  command-line-tool
Cfmt
cfmt is a tool to wrap Go comments over a certain length to a new line.
Stars: ✭ 28 (-22.22%)
Mutual labels:  static-analysis
Cryptography
Cryptography Android application code samples / cipher collection for app users
Stars: ✭ 35 (-2.78%)
Mutual labels:  cryptography
Catchart
Pipe something from command line to a chart in the browser
Stars: ✭ 27 (-25%)
Mutual labels:  command-line-tool
Claimchain Core
A core and experimental implementation of ClaimChain
Stars: ✭ 30 (-16.67%)
Mutual labels:  cryptography
Ufonet
UFONet - Denial of Service Toolkit
Stars: ✭ 963 (+2575%)
Mutual labels:  cryptography
Wsay
Windows "say"
Stars: ✭ 36 (+0%)
Mutual labels:  command-line-tool

Build Status

CogniCryptSAST

This repository contains CogniCryptSAST, the static analysis component for CogniCrypt. The static analysis CogniCryptSAST takes rules written in the specification language CrySL as input, and performs a static analysis based on the specification of the rules. CrySL is a domain-specific language (DSL) designed to encode usage specifications for cryptographic libaries (e.g., the JCA in particular). More information on CrySL and the static analysis may be found in this paper.

Releases

You can checkout a pre-compiled version of CogniCryptSAST here.

Download the two files:

  • CryptoAnalysis-x.y.z-jar-with-dependencies.jar
  • JCA-CrySL-rules.zip

Checkout and Build

CogniCryptSAST uses Maven as build tool. You can compile and build this project via

mvn package -DskipTests=true.

A packaged jar artifact including all dependency is found in CryptoAnalysis/build/CryptoAnalysis-x.y.z-jar-with-dependencies.jar

Usage

CogniCryptSAST can be started in headless mode (i.e., detached from Eclipse) via the class crypto.HeadlessCryptoScanner. It requires two arguments:

  • The absolute path to the directory of the CrySL (source code format) rule files. The source code for the rules which contains spesification for the JCA is found here.
  • The absolute path of the application to be analyzed (.jar file or the root compilation output folder which contains the .class files in subdirectories)
java -cp <path-to-analysis-jar> crypto.HeadlessCryptoScanner \
      --rulesDir <absolute-path-to-crysl-source-code-format-rules> \
      --appPath <absolute-application-path>

For an easy start we prepared a .jar containing classes with crypto misuses. The source code for these misuses is found here. To run CogniCryptSAST on these classes, simply execute the following command (on a linux based system).

java -cp CryptoAnalysis/build/CryptoAnalysis-2.6-jar-with-dependencies.jar crypto.HeadlessCryptoScanner \
  --rulesDir $(pwd)/CryptoAnalysis/src/main/resources/JavaCryptographicArchitecture \
  --appPath $(pwd)/CryptoAnalysisTargets/CogniCryptDemoExample/Examples.jar

Other additional arguments that can be used are as follows:

--cg <selection_of_call_graph_for_analysis> (possible values are CHA, SPARK, SPARKLIB)
--sootPath <absolute_path_of_whole_project>
--identifier <identifier_for_labelling_output_files>
--reportPath <directory_location_for_cognicrypt_report>
--reportFormat <format of cognicrypt_report> (possible values are TXT, SARIF, CSV)
--preanalysis (enables pre-analysis)
--visualization (enables the visualization, but also requires --reportPath option to be set)
--providerDetection (enables provider detection analysis)

Note, depending on the analyzed application, the analysis may require a lot of memory and a large stack size. Remember to set the necessary heap size (e.g. -Xmx8g) and stack size (e.g. -Xss60m).

Report and Error Types

In the standard option, CogniCryptSAST outputs a report to the console. CogniCryptSAST reporst misuses when the code is not compliant with the CrySL rules. For each misuse CogniCryptSAST reports the class and the method the misuse is contained in. There are multiple misuse types:

  • ConstraintError: A constraint of a CrySL rule is violated, e.g., a key is generated with the wrong key size.

  • NeverTypeOfError: Reported when a value was found to be of a certain reference type: For example, a character array containing a password should never be converted from a String. (see KeyStore rule here).

  • ForbiddenMethodError: A method that is forbidden (CrySL block FORBIDDEN) to be called under some circumstances was found.

  • ImpreciseValueExtractionError: The static analysis was not able to extract all information required within the CrySL CONSTRAINT block. For example the key size could be supplied as a value listed in a configuration file. The static analysis does not model the file's content and may not constraint on the value.

  • TypestateError: The ORDER block of CrySL is violated, i.e., the expected method sequence call to be made is incorrect. For example, a Signature object expects a call to initSign(key) prior to update(data).

  • RequiredPredicateError: An object A expects an object B to have been used correctly (CrySL blocks REQUIRES and ENSURES). For example a Cipher object requires a SecretKey object to be correctly and securely generated.

  • IncompleteOperationError: The usage of an object may be incomplete: For example a Cipherobject may be initialized but never used for en- or decryption, this may render the code dead. This error heavily depends on the computed call graph (CHA by default).

When the option --reportPath <directory_location_for_cognicrypt_report> is chosen, CogniCryptSAST writes the report to the file CogniCrypt-Report.txt and additionally outputs the .jimple files of the classes where misuses where found in. Jimple is an intermediate representation close to the syntax of Java.

Updating CrySL Rules

The tool takes CrySL rules in their source code formats (crysl). You can adapt the rules in any text editor. Additionaly, the Eclipse plugin CogniCrypt ships with a CrySL editor to modify the rules with IDE support (e.g., content assist, auto completion, etc.). A step-by-step-explanation on how edit CrySL rules is avialable at the tool's website cognicrypt.org.

CogniCryptSAST for Android Applications

CogniCryptSAST can also be run on Android Applications using the Android version for CogniCryptSAST in CryptoAnalysis-Android. Its usage does not deviate much from regular CogniCryptSAST's. CogniCrypt_SAST for Android can be started via the class de.fraunhofer.iem.crypto.CogniCryptAndroid. It requires three arguments in this order:

  • The absolute path to the .apk file
  • The absolute path to the android SDK platforms. The platforms are obtainable via Android Studio. Under the Android SDK location you find a folder platforms. Supply CogniCryptSAST with the path to this folder.
  • The absolute path to the directory of the CrySL rules.
java -cp <path-to-analysis-jar> -Xmx8g -Xss60m de.fraunhofer.iem.crypto.CogniCryptAndroid \
      <path-to-apk> <path-to-android-platforms> <path-to-crysl-rules>

As an optional fourth parameter one can specify an output folder:

java -cp <path-to-analysis-jar> -Xmx8g -Xss60m de.fraunhofer.iem.crypto.CogniCryptAndroid \
      <path-to-apk> <path-to-android-platforms> <path-to-crysl-rules> <output-dir>

If specified, the analysis generates a report file CogniCrypt-Report.txt along with the .jimple output of the classes the analysis found misuses in. The format of the report file follows that described above.

Note, depending on the analyzed application, the analysis may require a lot of memory and a large stack size. Remember to set the necessary heap size (e.g. -Xmx8g) and stack size (e.g. -Xss60m).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].