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

Java: Introduce Freemarker for SSTI queries #6320

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

japroc
Copy link
Contributor

@japroc japroc commented Jul 18, 2021

Hi team!

I want to add support for Freemarker template engine.
There is a Freemarker.qll library and 2 queries.

Query 1 - FreemarkerTaintedTemplate.ql
Search for cases when untrusted data is used as template. It may lead to remote code execution and information disclosure vulnerabilities.

Query 2 - FreemarkerUnsafeConfiguration.ql
Search for unsafe freemarker configurations. It is not critical by default. Although, when developers use builtin interpret filter on user-data, they will be executed as part of template. As i know it's impossible to analyze ftl files. As mitigation it's recommended to configure secure engine by 1) not enabling Builtin API, 2) setting class resolver to ALLOWS_NOTHING_RESOLVER.

Thanks,
Evgenii.

@japroc japroc requested a review from a team as a code owner July 18, 2021 18:30
@intrigus-lgtm
Copy link
Contributor

FYI: There is a similar PR #5935

@smowton
Copy link
Contributor

smowton commented Jul 19, 2021

In the event they differ enough: @japroc are you applying to the bounty program for this?

@japroc
Copy link
Contributor Author

japroc commented Jul 20, 2021

Hi @intrigus-lgtm and @smowton,

Unfortunately, i have not seen that PR (#5935) earlier. It looks similar. I think mine FreemarkerTaintedTemplate.ql covers same vulnerabilities.
Although this PR also contains FreemarkerUnsafeConfiguration.ql query. It's description is in first comment of this PR.

In the event they differ enough: @japroc are you applying to the bounty program for this?

Yes, i wanted to apply for bounty after some discussion

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

Successfully merging this pull request may close these issues.

3 participants