Example Analysis
To show how CogniCryptSAST works, we consider the following code example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
Using the JCA rules, we can use the HeadlessJavaScanner
to analyze the compiled version of this program:
1 2 3 4 5 6 7 |
|
Soot
as the underlying analysis framework, we print the report to the command line, and we enable the visualization. CogniCryptSAST runs the analysis and reports 3 ConstraintErrors, 2 RequiredPredicateErrors and 1 IncompleteOperationError, and their positions in the original programs. Additionally, since we use --visualization
, it creates the following image visualization.png
in the directory ./output/
:
You can see that two ConstraintErrors on the object l1
(KeyGenerator) cause a RequiredPredicateError on the object l2
(SecretKey) which in turn causes a RequiredPredicateError on the object l3
(Cipher). Additionally, there is another ConstraintError and IncompleteOperationError on the Cipher object. Note that the variables and statements correspond to the intermediate representation Jimple. You can match the variables to the command line output that lists all analyzed objects.