github / github/securitylab

[Java] CWE-117: CodeQL query to detect Log Injection

オープン
#144 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C
スター
1.6k
フォーク
300
PR マージ指標
30日以内にマージされた PR はありません

説明

## CVE ID(s)

*List the CVE ID(s) associated with this vulnerability. GitHub will automatically link CVE IDs to the [GitHub Advisory Database](https://github.com/advisories).*

- There is no CVE for this.

## Report

Log Injection query is available in c# query, javascript (experimental) query but it is not available in java query.
I created a query to detect a log injection vulnerability in java code.

Link to the PR: PR github/codeql#3882

- [X] Are you planning to discuss this vulnerability submission publicly? (Blog Post, social networks, etc). *We would love to have you spread the word about the good work you are doing*

## Result(s)

The query was able to detect a potential Log Forging (now fixed) in the `generator-jhipster` project.
This is the PR fixing the potential Log Forging: [prevent potential log forging](https://github.com/jhipster/generator-jhipster/pull/11708), and here the fixed code [https://github.com/jhipster/generator-jhipster/pull/11708/files](https://github.com/jhipster/generator-jhipster/pull/11708/files).

To test the query, I used the vulnerable version of that file. I created a project using `jhipster` ([Creating an application](https://www.jhipster.tech/creating-an-app/)), and then I run the query on the project already created; the query was able to detect the vulnerability mentioned in the PR (once I created the project, before generating the database, I replaced the fixed code, with its previous version).

There is also a CVE (another project): [CVE-2020-4072: Log Forging in generator-jhipster-kotlin](https://github.com/advisories/GHSA-pfxf-wh96-fvjc), that mentions the equivalent `java` file of the `generator-jhipter` project: [commit: prevent log forging when doing password reset init request](https://github.com/jhipster/jhipster-kotlin/commit/426ccab85e7e0da562643200637b99b6a2a99449).

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

既存の C# および実験的な JavaScript の log-injection クエリを確認し、その後、PR github/codeql#3882 で提案されているクエリを調査します。issue に記載されている脆弱な generator-jhipster コードに対してチェックを再現します。完了の条件は、Java クエリが報告された log-forging のフローを検出することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
security
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。