Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecursionError in _get_varname_value_from_context #13

Open
jndre opened this issue Oct 31, 2023 · 0 comments · Fixed by #14
Open

RecursionError in _get_varname_value_from_context #13

jndre opened this issue Oct 31, 2023 · 0 comments · Fixed by #14

Comments

@jndre
Copy link
Contributor

jndre commented Oct 31, 2023

When parsing JS code that has some kind of recursion and includes a sink, the data flow analysis infinitely recurses until we receive RecursionError: maximum recursion depth exceeded.

example for request highjacking:

<html>

<body>
    <script>
        let source = location.hash;

        function foo(param, depth) {
            if (depth > 10) {
                fetch(param);
            } else {
                bar(param, depth + 1);
            }
        }

        function bar(param, depth) {
            foo(param, depth + 1);
        }

        foo(source, 0);
    </script>
</body>

</html>

The recursion in the data flow analysis goes:

  • _get_varname_value_from_context
  • get_function_def_of_block_stmt
  • check_if_function_has_param
  • get_function_call_values_of_function_definitions
  • _get_varname_value_from_context ...

This bug was triggered by some third-party library scripts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants