Fuzz introspector
For issues and ideas: https://github.com/ossf/fuzz-introspector/issues

Project functions overview

The following table shows data about each function in the project. The functions included in this table correspond to all functions that exist in the executables of the fuzzers. As such, there may be functions that are from third-party libraries.

For further technical details on the meaning of columns in the below table, please see the Glossary .

Func name Functions filename Args Function call depth Reached by Fuzzers Runtime reached by Fuzzers Combined reached by Fuzzers Fuzzers runtime hit Func lines hit % I Count BB Count Cyclomatic complexity Functions reached Reached by functions Accumulated cyclomatic complexity Undiscovered complexity

Fuzzer details

Fuzzer: fuzz_env_jinja_lexer

Call tree

The calltree shows the control flow of the fuzzer. This is overlaid with coverage information to display how much of the potential code a fuzzer can reach is in fact covered at runtime. In the following there is a link to a detailed calltree visualisation as well as a bitmap showing a high-level view of the calltree. For further information about these topics please see the glossary for full calltree and calltree overview

Call tree overview bitmap:

The distribution of callsites in terms of coloring is
Color Runtime hitcount Callsite count Percentage
red 0 14 4.30%
gold [1:9] 0 0.0%
yellow [10:29] 0 0.0%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 311 95.6%
All colors 325 100

Fuzz blockers

The following nodes represent call sites where fuzz blockers occur.

Amount of callsites blocked Calltree index Parent function Callsite Largest blocked function
3 17 jinja2.environment.Environment._tokenize call site: 00017 jinja2.lexer.TokenStream.__init__
2 286 jinja2.parser.Parser._fail_ut_eof call site: 00286 .map
1 12 jinja2.environment.Environment.preprocess call site: 00012 jinja2.environment.Environment.iter_extensions
1 15 jinja2.environment.Environment.iter_extensions call site: 00015 .str
1 119 jinja2.parser.Parser.parse_subscript call site: 00119 jinja2.parser.Parser.fail
1 131 jinja2.parser.Parser.parse_call_args call site: 00131 jinja2.lexer.TokenStream.look
1 162 jinja2.parser.Parser.parse_test call site: 00162 jinja2.lexer.Token.test_any
1 232 jinja2.parser.Parser.parse_tuple call site: 00232 jinja2.lexer.describe_token
1 253 jinja2.parser.Parser.parse_assign_target call site: 00253 jinja2.parser.Parser.parse_primary
1 264 jinja2.parser.Parser.parse_assign_target call site: 00264 .type
1 301 jinja2.parser.Parser.subparse call site: 00301 body.extend

Runtime coverage analysis

Covered functions
474
Functions that are reachable but not covered
45
Reachable functions
115
Percentage of reachable functions covered
60.87%
NB: The sum of covered functions and functions that are reachable but not covered need not be equal to Reachable functions . This is because the reachability analysis is an approximation and thus at runtime some functions may be covered that are not included in the reachability analysis. This is a limitation of our static analysis capabilities.
Warning: The number of covered functions are larger than the number of reachable functions. This means that there are more functions covered at runtime than are extracted using static analysis. This is likely a result of the static analysis component failing to extract the right call graph or the coverage runtime being compiled with sanitizers in code that the static analysis has not analysed. This can happen if lto/gold is not used in all places that coverage instrumentation is used.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
/ 1
...fuzz_env_jinja_lexer 6
jinja2.environment 20
jinja2.parser 72
jinja2.lexer 12
jinja2.nodes 9
jinja2.compiler 4

Fuzzer: fuzz_jinja_compile_templates

Call tree

The calltree shows the control flow of the fuzzer. This is overlaid with coverage information to display how much of the potential code a fuzzer can reach is in fact covered at runtime. In the following there is a link to a detailed calltree visualisation as well as a bitmap showing a high-level view of the calltree. For further information about these topics please see the glossary for full calltree and calltree overview

Call tree overview bitmap:

The distribution of callsites in terms of coloring is
Color Runtime hitcount Callsite count Percentage
red 0 31 8.24%
gold [1:9] 0 0.0%
yellow [10:29] 0 0.0%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 345 91.7%
All colors 376 100

Fuzz blockers

The following nodes represent call sites where fuzz blockers occur.

Amount of callsites blocked Calltree index Parent function Callsite Largest blocked function
8 21 jinja2.environment.Environment.__init__ call site: 00021 jinja2.utils.import_string
3 32 ...fuzz_jinja_compile_templates.TestOneInput call site: 00032 zipfile.ZipFile
3 56 jinja2.environment.Environment._tokenize call site: 00056 jinja2.lexer.TokenStream.__init__
2 41 jinja2.loaders.DictLoader.list_templates call site: 00041 jinja2.environment.Environment.list_templates.filter_func
2 325 jinja2.parser.Parser._fail_ut_eof call site: 00325 .map
2 366 jinja2.environment.Environment.compile_templates call site: 00366 zipfile.ZipInfo
1 36 jinja2.environment.Environment.compile_templates call site: 00036 os.makedirs
1 51 jinja2.environment.Environment.preprocess call site: 00051 jinja2.environment.Environment.iter_extensions
1 54 jinja2.environment.Environment.iter_extensions call site: 00054 .str
1 158 jinja2.parser.Parser.parse_subscript call site: 00158 jinja2.parser.Parser.fail
1 170 jinja2.parser.Parser.parse_call_args call site: 00170 jinja2.lexer.TokenStream.look
1 201 jinja2.parser.Parser.parse_test call site: 00201 jinja2.lexer.Token.test_any

Runtime coverage analysis

Covered functions
474
Functions that are reachable but not covered
69
Reachable functions
155
Percentage of reachable functions covered
55.48%
NB: The sum of covered functions and functions that are reachable but not covered need not be equal to Reachable functions . This is because the reachability analysis is an approximation and thus at runtime some functions may be covered that are not included in the reachability analysis. This is a limitation of our static analysis capabilities.
Warning: The number of covered functions are larger than the number of reachable functions. This means that there are more functions covered at runtime than are extracted using static analysis. This is likely a result of the static analysis component failing to extract the right call graph or the coverage runtime being compiled with sanitizers in code that the static analysis has not analysed. This can happen if lto/gold is not used in all places that coverage instrumentation is used.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
/ 1
...fuzz_jinja_compile_templates 12
jinja2.environment 47
jinja2.utils 7
jinja2.loaders 5
jinja2.parser 72
jinja2.lexer 12
jinja2.nodes 9
jinja2.compiler 4

Fuzzer: fuzz_jinja_compile_expr

Call tree

The calltree shows the control flow of the fuzzer. This is overlaid with coverage information to display how much of the potential code a fuzzer can reach is in fact covered at runtime. In the following there is a link to a detailed calltree visualisation as well as a bitmap showing a high-level view of the calltree. For further information about these topics please see the glossary for full calltree and calltree overview

Call tree overview bitmap:

The distribution of callsites in terms of coloring is
Color Runtime hitcount Callsite count Percentage
red 0 17 5.13%
gold [1:9] 0 0.0%
yellow [10:29] 0 0.0%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 314 94.8%
All colors 331 100

Fuzz blockers

The following nodes represent call sites where fuzz blockers occur.

Amount of callsites blocked Calltree index Parent function Callsite Largest blocked function
3 0 EP call site: 00000 jinja2.environment.Environment.compile_expression
3 12 jinja2.environment.Environment._tokenize call site: 00012 jinja2.lexer.TokenStream.__init__
2 298 jinja2.parser.Parser._fail_ut_eof call site: 00298 .map
1 7 jinja2.environment.Environment.preprocess call site: 00007 jinja2.environment.Environment.iter_extensions
1 10 jinja2.environment.Environment.iter_extensions call site: 00010 .str
1 79 jinja2.parser.Parser.parse_tuple call site: 00079 jinja2.lexer.describe_token
1 130 jinja2.parser.Parser.parse_subscript call site: 00130 jinja2.parser.Parser.fail
1 142 jinja2.parser.Parser.parse_call_args call site: 00142 jinja2.lexer.TokenStream.look
1 173 jinja2.parser.Parser.parse_test call site: 00173 jinja2.lexer.Token.test_any
1 265 jinja2.parser.Parser.parse_assign_target call site: 00265 jinja2.parser.Parser.parse_primary
1 276 jinja2.parser.Parser.parse_assign_target call site: 00276 .type
1 313 jinja2.parser.Parser.subparse call site: 00313 body.extend

Runtime coverage analysis

Covered functions
474
Functions that are reachable but not covered
42
Reachable functions
115
Percentage of reachable functions covered
63.48%
NB: The sum of covered functions and functions that are reachable but not covered need not be equal to Reachable functions . This is because the reachability analysis is an approximation and thus at runtime some functions may be covered that are not included in the reachability analysis. This is a limitation of our static analysis capabilities.
Warning: The number of covered functions are larger than the number of reachable functions. This means that there are more functions covered at runtime than are extracted using static analysis. This is likely a result of the static analysis component failing to extract the right call graph or the coverage runtime being compiled with sanitizers in code that the static analysis has not analysed. This can happen if lto/gold is not used in all places that coverage instrumentation is used.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
/ 1
...fuzz_jinja_compile_expr 3
jinja2.environment 25
jinja2.parser 72
jinja2.lexer 12
jinja2.nodes 9
jinja2.compiler 4

Analyses and suggestions

Optimal target analysis

Remaining optimal interesting functions

The following table shows a list of functions that are optimal targets. Optimal targets are identified by finding the functions that in combination, yield a high code coverage.

Func name Functions filename Arg count Args Function depth hitcount instr count bb count cyclomatic complexity Reachable functions Incoming references total cyclomatic complexity Unreached complexity
jinja2.compiler.CodeGenerator.visit_Macro jinja2.compiler 3 ['N/A', 'N/A', 'N/A'] 7 0 5 2 4 58 0 187 152
jinja2.ext.InternationalizationExtension.parse jinja2.ext 2 ['N/A', 'N/A'] 2 0 14 20 11 35 0 125 84
jinja2.compiler.optimizeconst.new_func jinja2.compiler 4 ['N/A', 'N/A', 'N/A', 'N/A'] 5 0 0 2 4 49 0 167 81
jinja2.filters.do_urlize jinja2.filters 7 ['N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A'] 3 0 3 5 5 27 0 90 72
jinja2.filters.async_select_or_reject jinja2.filters 6 ['N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A'] 3 0 1 2 4 25 4 81 72
jinja2.debug.rewrite_traceback_stack jinja2.debug 1 ['N/A'] 3 0 4 3 4 24 0 80 68
jinja2.lexer.Lexer.tokeniter jinja2.lexer 5 ['N/A', 'N/A', 'N/A', 'N/A', 'N/A'] 1 0 11 27 14 19 1 71 56
jinja2.ext.babel_extract jinja2.ext 4 ['N/A', 'N/A', 'N/A', 'N/A'] 39 0 2 5 5 133 0 451 55
jinja2.compiler.CodeGenerator.visit_Template jinja2.compiler 3 ['N/A', 'N/A', 'N/A'] 6 0 44 11 7 56 0 182 53
jinja2.nodes._FilterTestCommon.as_const jinja2.nodes 2 ['N/A', 'N/A'] 3 0 3 6 5 16 0 55 37

Implementing fuzzers that target the above functions will improve reachability such that it becomes:

Functions statically reachable by fuzzers
22.0%
167 / 746
Cyclomatic complexity statically reachable by fuzzers
25.0%
624 / 2529

All functions overview

If you implement fuzzers for these functions, the status of all functions in the project will be:

Func name Functions filename Args Function call depth Reached by Fuzzers Runtime reached by Fuzzers Combined reached by Fuzzers Fuzzers runtime hit Func lines hit % I Count BB Count Cyclomatic complexity Functions reached Reached by functions Accumulated cyclomatic complexity Undiscovered complexity

Fuzz engine guidance

This sections provides heuristics that can be used as input to a fuzz engine when running a given fuzz target. The current focus is on providing input that is usable by libFuzzer.

/src/fuzz_env_jinja_lexer.py

Dictionary

Use this with the libFuzzer -dict=DICT.file flag


Fuzzer function priority

Use one of these functions as input to libfuzzer with flag: -focus_function name

-focus_function=['jinja2.environment.Environment._tokenize', 'jinja2.parser.Parser._fail_ut_eof', 'jinja2.environment.Environment.preprocess', 'jinja2.environment.Environment.iter_extensions', 'jinja2.parser.Parser.parse_subscript', 'jinja2.parser.Parser.parse_call_args', 'jinja2.parser.Parser.parse_test', 'jinja2.parser.Parser.parse_tuple', 'jinja2.parser.Parser.parse_assign_target']

/src/fuzz_jinja_compile_templates.py

Dictionary

Use this with the libFuzzer -dict=DICT.file flag


Fuzzer function priority

Use one of these functions as input to libfuzzer with flag: -focus_function name

-focus_function=['jinja2.environment.Environment.__init__', '...fuzz_jinja_compile_templates.TestOneInput', 'jinja2.environment.Environment._tokenize', 'jinja2.loaders.DictLoader.list_templates', 'jinja2.parser.Parser._fail_ut_eof', 'jinja2.environment.Environment.compile_templates', 'jinja2.environment.Environment.preprocess', 'jinja2.environment.Environment.iter_extensions', 'jinja2.parser.Parser.parse_subscript']

/src/fuzz_jinja_compile_expr.py

Dictionary

Use this with the libFuzzer -dict=DICT.file flag


Fuzzer function priority

Use one of these functions as input to libfuzzer with flag: -focus_function name

-focus_function=['jinja2.environment.Environment._tokenize', 'jinja2.parser.Parser._fail_ut_eof', 'jinja2.environment.Environment.preprocess', 'jinja2.environment.Environment.iter_extensions', 'jinja2.parser.Parser.parse_tuple', 'jinja2.parser.Parser.parse_subscript', 'jinja2.parser.Parser.parse_call_args', 'jinja2.parser.Parser.parse_test', 'jinja2.parser.Parser.parse_assign_target']

Files and Directories in report

This section shows which files and directories are considered in this report. The main reason for showing this is fuzz introspector may include more code in the reasoning than is desired. This section helps identify if too many files/directories are included, e.g. third party code, which may be irrelevant for the threat model. In the event too much is included, fuzz introspector supports a configuration file that can exclude data from the report. See the following link for more information on how to create a config file: link

Files in report

Source file Reached by Covered by
[] []
collections [] []
jinja2.sandbox [] []
jinja2.lexer ['fuzz_env_jinja_lexer', 'fuzz_jinja_compile_templates', 'fuzz_jinja_compile_expr'] []
zipfile [] []
pprint [] []
jinja2.meta [] []
jinja2.debug [] []
jinja2.filters [] []
random [] []
sys [] []
jinja2._identifier [] []
stat [] []
jinja2.idtracking [] []
re [] []
weakref [] []
enum [] []
hashlib [] []
jinja2.compiler ['fuzz_env_jinja_lexer', 'fuzz_jinja_compile_templates', 'fuzz_jinja_compile_expr'] []
jinja2.runtime [] []
warnings [] []
textwrap [] []
jinja2.nativetypes [] []
atheris [] []
jinja2.constants [] []
typing [] []
jinja2.utils ['fuzz_jinja_compile_templates'] []
_string [] []
os [] []
asyncio [] []
tempfile [] []
json [] []
inspect [] []
jinja2.visitor [] []
functools [] []
jinja2.loaders ['fuzz_jinja_compile_templates'] []
markupsafe [] []
posixpath [] []
jinja2.optimizer [] []
fnmatch [] []
io [] []
logging [] []
...fuzz_jinja_compile_templates ['fuzz_jinja_compile_templates'] []
itertools [] []
jinja2.ext [] []
gettext [] []
jinja2.tests [] []
string [] []
jinja2.bccache [] []
jinja2.parser ['fuzz_env_jinja_lexer', 'fuzz_jinja_compile_templates', 'fuzz_jinja_compile_expr'] []
contextlib [] []
pickle [] []
importlib [] []
threading [] []
jinja2 [] []
jinja2.async_utils [] []
jinja2.defaults [] []
[] []
jinja2.environment ['fuzz_env_jinja_lexer', 'fuzz_jinja_compile_templates', 'fuzz_jinja_compile_expr'] []
ast [] []
urllib [] []
...fuzz_env_jinja_lexer ['fuzz_env_jinja_lexer'] []
jinja2.exceptions [] []
jinja2.nodes ['fuzz_env_jinja_lexer', 'fuzz_jinja_compile_templates', 'fuzz_jinja_compile_expr'] []
...fuzz_jinja_compile_expr ['fuzz_jinja_compile_expr'] []
traceback [] []
keyword [] []
marshal [] []

Directories in report

Directory