fluent-vulnerability_checker 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/linux.yml +38 -0
- data/.github/workflows/windows.yml +38 -0
- data/.rubocop.yml +18 -0
- data/LICENSE +202 -0
- data/README.md +65 -0
- data/Rakefile +12 -0
- data/exe/fluent-vulnerabilitycheck +50 -0
- data/lib/fluent/vulnerability_checker.rb +240 -0
- data/test/fluent/resources/safe/in_monitor_agent.conf +4 -0
- data/test/fluent/resources/safe/out_file_buffer_file.conf +9 -0
- data/test/fluent/resources/safe/out_http.conf +8 -0
- data/test/fluent/resources/unsafe/dos_in_forward.conf +3 -0
- data/test/fluent/resources/unsafe/dos_in_http.conf +3 -0
- data/test/fluent/resources/unsafe/dos_in_opentelemetry.conf +10 -0
- data/test/fluent/resources/unsafe/dos_in_s3.conf +5 -0
- data/test/fluent/resources/unsafe/exposure_of_sensitive_information.conf +8 -0
- data/test/fluent/resources/unsafe/remote_code_execution_buffer_file.conf +20 -0
- data/test/fluent/resources/unsafe/remote_code_execution_out_file.conf +19 -0
- data/test/fluent/resources/unsafe/remote_code_execution_out_secondary_file.conf +15 -0
- data/test/fluent/resources/unsafe/remote_code_execution_secondary_out_file.conf +24 -0
- data/test/fluent/resources/unsafe/remote_code_execution_store_out_file.conf +16 -0
- data/test/fluent/resources/unsafe/ssrf_out_http.conf +4 -0
- data/test/fluent/resources/unsafe/test_vulnerable.yaml +17 -0
- data/test/fluent/test_vulnerability_checker.rb +141 -0
- metadata +82 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: cd7c2d2cbbef103a4de79835df5be2bde07be9fb280d7358488400be08ddce39
|
|
4
|
+
data.tar.gz: 104bfc90898a715a10723349b8049b7ac57e9221370d7d67258666d2b11f3b69
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 010a075d2bf357418f6d2dc7390dd082ef137c80914bb53a6d54c159458609466e10dd6051eb25b8e6fa9b361e120e88e1783f249ecce0ad56164e69ba947741
|
|
7
|
+
data.tar.gz: 14d93635f7c948b18826be70c30a6955a9ed6be8f68e11e7b77e58065ce055b92ba67032f228695c13e4bf4d6d4d525321202d7cc83a9cb28577ebce0388f287
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Testing on Ubuntu
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [main]
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: '0 0 1 * *'
|
|
9
|
+
jobs:
|
|
10
|
+
ruby-versions:
|
|
11
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
|
12
|
+
with:
|
|
13
|
+
engine: cruby
|
|
14
|
+
min_version: 2.7
|
|
15
|
+
build:
|
|
16
|
+
needs: ruby-versions
|
|
17
|
+
runs-on: ${{ matrix.os }}
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
|
22
|
+
exclude:
|
|
23
|
+
- ruby: head
|
|
24
|
+
os:
|
|
25
|
+
- ubuntu-latest
|
|
26
|
+
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
29
|
+
- uses: ruby/setup-ruby@6ca151fd1bfcfd6fe0c4eb6837eb0584d0134a0c # v1.290.0
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
|
32
|
+
rubygems: latest
|
|
33
|
+
- name: unit testing
|
|
34
|
+
env:
|
|
35
|
+
CI: true
|
|
36
|
+
run: |
|
|
37
|
+
bundle install --jobs 4 --retry 3
|
|
38
|
+
bundle exec rake test
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Testing on Windows
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [main]
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: '0 0 1 * *'
|
|
9
|
+
jobs:
|
|
10
|
+
ruby-versions:
|
|
11
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
|
12
|
+
with:
|
|
13
|
+
engine: cruby
|
|
14
|
+
min_version: 2.7
|
|
15
|
+
build:
|
|
16
|
+
needs: ruby-versions
|
|
17
|
+
runs-on: ${{ matrix.os }}
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
|
22
|
+
exclude:
|
|
23
|
+
- ruby: head
|
|
24
|
+
os:
|
|
25
|
+
- windows-latest
|
|
26
|
+
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
29
|
+
- uses: ruby/setup-ruby@6ca151fd1bfcfd6fe0c4eb6837eb0584d0134a0c # v1.290.0
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
|
32
|
+
rubygems: latest
|
|
33
|
+
- name: unit testing
|
|
34
|
+
env:
|
|
35
|
+
CI: true
|
|
36
|
+
run: |
|
|
37
|
+
bundle install --jobs 4 --retry 3
|
|
38
|
+
bundle exec rake test
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
# td-agent 4 or later
|
|
3
|
+
TargetRubyVersion: 2.7
|
|
4
|
+
NewCops: enable
|
|
5
|
+
|
|
6
|
+
Gemspec:
|
|
7
|
+
Enabled: true
|
|
8
|
+
Layout:
|
|
9
|
+
Enabled: false
|
|
10
|
+
Lint:
|
|
11
|
+
Enabled: false
|
|
12
|
+
Metrics:
|
|
13
|
+
Enabled: false
|
|
14
|
+
Security:
|
|
15
|
+
Enabled: true
|
|
16
|
+
Style:
|
|
17
|
+
Enabled: false
|
|
18
|
+
|
data/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# fluent-vulnerability_checker
|
|
2
|
+
|
|
3
|
+
A static analysis tool that detects known security risks in Fluentd configuration files and provides actionable remediation advice.
|
|
4
|
+
|
|
5
|
+
Fluentdの設定ファイルを解析し、既知の脆弱性につながる危険な設定を検知するセキュリティ監査ツールです。
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
Detects configurations leading to the following vulnerabilities:
|
|
9
|
+
|
|
10
|
+
* CVE-2026-44024 [Remote Code Execution (RCE)](https://github.com/fluent/fluentd/security/advisories/GHSA-44hj-4m45-frj3)
|
|
11
|
+
* CVE-2026-44161 [Server-Side Request Forgery (SSRF)](https://github.com/fluent/fluentd/security/advisories/GHSA-72f5-rr8c-r6gr)
|
|
12
|
+
* CVE-2026-44160 [Denial of Service (DoS)](https://github.com/fluent/fluentd/security/advisories/GHSA-j9cw-hwqf-85w7)
|
|
13
|
+
* CVE-2026-44025 [Exposure of Sensitive Information](https://github.com/fluent/fluentd/security/advisories/GHSA-pr7j-96cj-549h)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
Install the gem by executing:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
fluent-gem install fluent-vulnerability_checker
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
Run the `fluent-vulnerabilitycheck` command and pass the path to your Fluentd configuration file using the `-c` or `--config` option.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
$ fluent-vulnerabilitycheck -c /path/to/your/fluentd.conf
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If no path is provided, it defaults to Fluentd's standard configuration path (`/etc/fluent/fluent.conf`).
|
|
30
|
+
|
|
31
|
+
## Example Output
|
|
32
|
+
When a vulnerable configuration is detected, the tool provides a detailed report:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
# Exposure of Sensitive Information via Monitor Agent API
|
|
36
|
+
* Severity: High
|
|
37
|
+
* CVSS Score: 7.5
|
|
38
|
+
* Location: <source> - @type monitor_agent
|
|
39
|
+
* State: bind = '0.0.0.0'.
|
|
40
|
+
(Note: In Fluentd 1.19.2 and earlier, the default value of bind is 0.0.0.0.)
|
|
41
|
+
* Description:
|
|
42
|
+
* EN: monitor_agent is exposed externally, allowing attackers to read Fluentd configuration details via its API.
|
|
43
|
+
* JA: monitor_agentによって公開されているAPIを悪用して、Fluentdの設定内容を読み取られる危険性があります。
|
|
44
|
+
* Workaround:
|
|
45
|
+
* EN: If you cannot immediately update the package, apply mitigations such as restricting access,
|
|
46
|
+
or allowing access only from localhost.
|
|
47
|
+
* JA: すぐにパッケージを更新できない場合、アクセスの制限、ローカルホストからのみのアクセスを受け付けるなどの
|
|
48
|
+
緩和策を適用してください。
|
|
49
|
+
===================================================================================================================
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Support & Enterprise Services
|
|
53
|
+
If you need professional assistance for safe migration, or comprehensive Fluentd support,
|
|
54
|
+
please contact the ClearCode Fluentd support.
|
|
55
|
+
|
|
56
|
+
安全な移行計画の策定や包括的なサポートが必要な場合は、クリアコードのFluentdサポートまでご相談ください。
|
|
57
|
+
ご相談にはFluentdコアメンテナが対応いたします。
|
|
58
|
+
|
|
59
|
+
* [ClearCode Fluentd Support (Japanese)](https://www.clear-code.com/services/fluentd-service.html)
|
|
60
|
+
|
|
61
|
+
## Copyright
|
|
62
|
+
|
|
63
|
+
* Copyright 2026 ClearCode Inc.
|
|
64
|
+
* License
|
|
65
|
+
* Apache License, Version 2.0
|
data/Rakefile
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "bundler/setup"
|
|
5
|
+
require "fluent/vulnerability_checker.rb"
|
|
6
|
+
require "optparse"
|
|
7
|
+
|
|
8
|
+
config_path = Fluent::DEFAULT_CONFIG_PATH
|
|
9
|
+
|
|
10
|
+
op = OptionParser.new
|
|
11
|
+
op.on('-c', '--config PATH', "config file path (default: #{Fluent::DEFAULT_CONFIG_PATH})") { |s|
|
|
12
|
+
config_path = s
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
begin
|
|
16
|
+
op.parse!(ARGV)
|
|
17
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
18
|
+
checker.validate(config_path)
|
|
19
|
+
if checker.vulnerabilities == 0
|
|
20
|
+
puts "No vulnerabilities detected."
|
|
21
|
+
puts "脆弱性は検知されませんでした。"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
rescue OptionParser::InvalidOption
|
|
25
|
+
puts op.help
|
|
26
|
+
exit 1
|
|
27
|
+
rescue Errno::ENOENT
|
|
28
|
+
puts "Not found configuration file: #{config_path}"
|
|
29
|
+
puts ""
|
|
30
|
+
puts op.help
|
|
31
|
+
exit 1
|
|
32
|
+
rescue => e
|
|
33
|
+
puts e.message
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
puts ""
|
|
37
|
+
puts "-" * 115
|
|
38
|
+
puts <<~"MSG"
|
|
39
|
+
[Support & Enterprise Services]
|
|
40
|
+
If you need professional assistance for safe migration, or comprehensive Fluentd support,
|
|
41
|
+
please contact the ClearCode Fluentd support.
|
|
42
|
+
|
|
43
|
+
安全な移行計画の策定や包括的なサポートが必要な場合は、クリアコードのFluentdサポートまでご相談ください。
|
|
44
|
+
ご相談にはFluentdコアメンテナが対応いたします。
|
|
45
|
+
|
|
46
|
+
https://www.clear-code.com/services/fluentd-service.html
|
|
47
|
+
MSG
|
|
48
|
+
puts "-" * 115
|
|
49
|
+
|
|
50
|
+
exit checker.vulnerabilities > 0 ? 1 : 0
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'fluent/config'
|
|
4
|
+
require 'fluent/env'
|
|
5
|
+
|
|
6
|
+
module Fluent
|
|
7
|
+
class VulnerabilityChecker
|
|
8
|
+
CHUNK_ID_PLACEHOLDER_PATTERN = /\$\{chunk_id\}/
|
|
9
|
+
PLACEHOLDER_PATTERN = /\$\{.*?\}/
|
|
10
|
+
|
|
11
|
+
class Rule
|
|
12
|
+
def initialize(plugin_categories, plugin_name = nil, &condition_proc)
|
|
13
|
+
@plugin_categories = Array(plugin_categories)
|
|
14
|
+
@plugin_name = plugin_name
|
|
15
|
+
@condition_proc = condition_proc
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def register_report_message(&report_proc)
|
|
19
|
+
@report_proc = report_proc
|
|
20
|
+
self
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def report(element)
|
|
24
|
+
@report_proc&.call(element)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def safe?(element)
|
|
28
|
+
if @plugin_categories.include?(element.name) && @plugin_name == element['@type']
|
|
29
|
+
!@condition_proc.call(element)
|
|
30
|
+
else
|
|
31
|
+
true
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
attr_reader :vulnerabilities # for test
|
|
37
|
+
|
|
38
|
+
def initialize
|
|
39
|
+
@vulnerabilities = 0
|
|
40
|
+
@rules = []
|
|
41
|
+
|
|
42
|
+
# Fluentd: RCE via ${tag} in file in output/buffer/secondary/store sections
|
|
43
|
+
@rules << Rule.new(['match', 'buffer', 'secondary', 'store'], 'file') { |element|
|
|
44
|
+
# replace the safe ${chunk_id} with an empty string to clear it, and check if the remaining string contains ${...}
|
|
45
|
+
element['path']&.gsub(CHUNK_ID_PLACEHOLDER_PATTERN, '')&.match?(PLACEHOLDER_PATTERN)
|
|
46
|
+
}.register_report_message do |element|
|
|
47
|
+
<<~"MSG"
|
|
48
|
+
# Remote Code Execution (RCE) via Arbitrary File Write in Dynamic Placeholder
|
|
49
|
+
* Severity: Critical
|
|
50
|
+
* CVSS Score: 10.0
|
|
51
|
+
* Location: <#{element.name}> - @type #{element['@type']}
|
|
52
|
+
* State: path = '#{element['path']}'
|
|
53
|
+
* Description:
|
|
54
|
+
* EN: If the ${tag} placeholder is used in the path parameter of the file output plugin, there is a risk that
|
|
55
|
+
an attacker could write files to arbitrary paths, potentially leading to RCE.
|
|
56
|
+
* JA: pathでプレースホルダーにtagを指定している場合、設定ファイルの書き方や実行権限が不適切だと、任意のパスに
|
|
57
|
+
ファイルを書き込まれ、リモートからコード実行可能になる危険があります。
|
|
58
|
+
* Workaround:
|
|
59
|
+
* EN: If you cannot immediately update the package, apply mitigations such as restricting access,
|
|
60
|
+
running with non-root privileges, modifying the configuration file, or removing untrusted tags.
|
|
61
|
+
* JA: すぐにパッケージを更新できない場合、アクセスの制限、非root権限での実行、設定ファイルの修正、信頼できない
|
|
62
|
+
tagを除去するなどの緩和策を適用してください。
|
|
63
|
+
MSG
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Fluentd: RCE via ${tag} in secondary_file
|
|
67
|
+
@rules << Rule.new('secondary', 'secondary_file') { |element|
|
|
68
|
+
# replace the safe ${chunk_id} with an empty string to clear it, and check if the remaining string contains ${...}
|
|
69
|
+
element['directory']&.gsub(CHUNK_ID_PLACEHOLDER_PATTERN, '')&.match?(PLACEHOLDER_PATTERN) ||
|
|
70
|
+
element['basename']&.gsub(CHUNK_ID_PLACEHOLDER_PATTERN, '')&.match?(PLACEHOLDER_PATTERN)
|
|
71
|
+
}.register_report_message do |element|
|
|
72
|
+
state_msg = ['directory', 'basename'].map { |k| "#{k} = '#{element[k]}'" if element[k]&.match?(PLACEHOLDER_PATTERN) }.compact.join(', ')
|
|
73
|
+
<<~"MSG"
|
|
74
|
+
# Remote Code Execution (RCE) via Arbitrary File Write in Dynamic Placeholder
|
|
75
|
+
* Severity: Critical
|
|
76
|
+
* CVSS Score: 10.0
|
|
77
|
+
* Location: <#{element.name}> - @type #{element['@type']}
|
|
78
|
+
* State: #{state_msg}
|
|
79
|
+
* Description:
|
|
80
|
+
* EN: If the ${tag} placeholder is used in the directory or basename parameter of the secondary_file plugin,
|
|
81
|
+
there is a risk that an attacker could write files to arbitrary paths, potentially leading to RCE.
|
|
82
|
+
* JA: directoryまたはbasenameでプレースホルダーにtagを指定している場合、設定ファイルの書き方や実行権限が不適切だと、任意のパスに
|
|
83
|
+
ファイルを書き込まれ、リモートからコード実行可能になる危険があります。
|
|
84
|
+
* Workaround:
|
|
85
|
+
* EN: If you cannot immediately update the package, apply mitigations such as restricting access,
|
|
86
|
+
running with non-root privileges, modifying the configuration file, or removing untrusted tags.
|
|
87
|
+
* JA: すぐにパッケージを更新できない場合、アクセスの制限、非root権限での実行、設定ファイルの修正、信頼できない
|
|
88
|
+
tagを除去するなどの緩和策を適用してください。
|
|
89
|
+
MSG
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Fluentd: Exposure of Sensitive Information
|
|
93
|
+
@rules << Rule.new('source', 'monitor_agent') { |element| element['bind'].nil? || element['bind'] == '0.0.0.0' }.register_report_message do |element|
|
|
94
|
+
<<~"MSG"
|
|
95
|
+
# Exposure of Sensitive Information via Monitor Agent API
|
|
96
|
+
* Severity: High
|
|
97
|
+
* CVSS Score: 7.5
|
|
98
|
+
* Location: <#{element.name}> - @type #{element['@type']}
|
|
99
|
+
* State: bind = '#{element['bind'] || 'default'}'.
|
|
100
|
+
(Note: In Fluentd 1.19.2 and earlier, the default value of bind is 0.0.0.0.)
|
|
101
|
+
* Description:
|
|
102
|
+
* EN: monitor_agent is exposed externally, allowing attackers to read Fluentd configuration details via its API.
|
|
103
|
+
* JA: monitor_agentによって公開されているAPIを悪用して、Fluentdの設定内容を読み取られる危険性があります。
|
|
104
|
+
* Workaround:
|
|
105
|
+
* EN: If you cannot immediately update the package, apply mitigations such as restricting access,
|
|
106
|
+
or allowing access only from localhost.
|
|
107
|
+
* JA: すぐにパッケージを更新できない場合、アクセスの制限、ローカルホストからのみのアクセスを受け付けるなどの
|
|
108
|
+
緩和策を適用してください。
|
|
109
|
+
MSG
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Fluentd: DoS via Gzip Decompression in http input plugin
|
|
113
|
+
@rules << Rule.new('source', 'http') { |element| true }.register_report_message do |element|
|
|
114
|
+
<<~"MSG"
|
|
115
|
+
# Denial of Service (DoS) via Gzip Decompression Bomb
|
|
116
|
+
* Severity: High
|
|
117
|
+
* CVSS Score: 7.5
|
|
118
|
+
* Location: <#{element.name}> - @type #{element['@type']}
|
|
119
|
+
* Description:
|
|
120
|
+
* EN: Sending maliciously crafted gzip-compressed data to Fluentd can consume excessive memory during
|
|
121
|
+
decompression, potentially causing it to crash.
|
|
122
|
+
* JA: 細工したgzip圧縮データをFluentdへと送りつけることで、展開時に大量のメモリを消費させてFluentdをクラッシュ
|
|
123
|
+
する危険性があります。
|
|
124
|
+
* Workaround:
|
|
125
|
+
* EN: If you cannot immediately update the package, apply mitigations such as restricting access, or enforcing
|
|
126
|
+
size limits when decompressing content using a reverse proxy.
|
|
127
|
+
* JA: すぐにパッケージを更新できない場合、アクセスの制限、リバースプロキシ等を用いたGZIP展開時のサイズ制限等の
|
|
128
|
+
緩和策を適用してください。
|
|
129
|
+
MSG
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Fluentd: DoS via Gzip Decompression in forward input plugin
|
|
133
|
+
@rules << Rule.new('source', 'forward') { |element| true }.register_report_message do |element|
|
|
134
|
+
<<~"MSG"
|
|
135
|
+
# Denial of Service (DoS) via Gzip Decompression Bomb
|
|
136
|
+
* Severity: High
|
|
137
|
+
* CVSS Score: 7.5
|
|
138
|
+
* Location: <#{element.name}> - @type #{element['@type']}
|
|
139
|
+
* Description:
|
|
140
|
+
* EN: Sending maliciously crafted gzip-compressed data to Fluentd can consume excessive memory during
|
|
141
|
+
decompression, potentially causing it to crash.
|
|
142
|
+
* JA: 細工したgzip圧縮データを受信することで、展開時に大量のメモリを消費してFluentdがクラッシュする危険性が
|
|
143
|
+
あります。
|
|
144
|
+
* Workaround:
|
|
145
|
+
* EN: If you cannot immediately update the package, apply mitigations such as restricting access, or enforcing
|
|
146
|
+
size limits when decompressing content using a reverse proxy.
|
|
147
|
+
* JA: すぐにパッケージを更新できない場合、アクセスの制限、リバースプロキシ等を用いたGZIP展開時のサイズ制限等の
|
|
148
|
+
緩和策を適用してください。
|
|
149
|
+
MSG
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# fluent-plugin-s3: DoS via Gzip Decompression
|
|
153
|
+
@rules << Rule.new('source', 's3') { |element| true }.register_report_message do |element|
|
|
154
|
+
<<~"MSG"
|
|
155
|
+
# Denial of Service (DoS) via Gzip Decompression Bomb
|
|
156
|
+
* Severity: Low
|
|
157
|
+
* CVSS Score: 2.7
|
|
158
|
+
* Location: <#{element.name}> - @type #{element['@type']}
|
|
159
|
+
* Description:
|
|
160
|
+
* EN: Sending maliciously crafted gzip-compressed data from S3 to Fluentd can consume excessive memory when
|
|
161
|
+
processing requests, potentially causing it to crash.
|
|
162
|
+
* JA: 細工したgzip圧縮データをS3から受信することで、展開時に大量のメモリを消費してFluentdがクラッシュする
|
|
163
|
+
危険性があります。
|
|
164
|
+
* Workaround:
|
|
165
|
+
* EN: If you cannot immediately update the package, apply mitigations such as restricting access, or enforcing
|
|
166
|
+
size limits when decompressing content using a reverse proxy.
|
|
167
|
+
* JA: すぐにパッケージを更新できない場合、アクセスの制限、リバースプロキシ等を用いたGZIP展開時のサイズ制限等の
|
|
168
|
+
緩和策を適用してください。
|
|
169
|
+
MSG
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# fluent-plugin-opentelemetry: DoS
|
|
173
|
+
@rules << Rule.new('source', 'opentelemetry') { |element| true }.register_report_message do |element|
|
|
174
|
+
<<~"MSG"
|
|
175
|
+
# Denial of Service (DoS) via Gzip Decompression Bomb or Malicious HTTP Requests
|
|
176
|
+
* Severity: Moderate
|
|
177
|
+
* CVSS Score: 5.3
|
|
178
|
+
* Location: <#{element.name}> - @type #{element['@type']}
|
|
179
|
+
* Description:
|
|
180
|
+
* EN: Sending maliciously crafted gzip-compressed data to Fluentd can consume excessive memory when processing
|
|
181
|
+
requests, potentially causing it to crash.
|
|
182
|
+
* JA: 細工したgzip圧縮データやHTTPリクエストを受信することで、リクエスト処理時に大量のメモリを消費してFluentdが
|
|
183
|
+
クラッシュする危険性があります。
|
|
184
|
+
* Workaround:
|
|
185
|
+
* EN: If you cannot immediately update the package, apply mitigations such as restricting access, or enforcing
|
|
186
|
+
size limits when processing requests using a reverse proxy.
|
|
187
|
+
* JA: すぐにパッケージを更新できない場合、アクセスの制限、リバースプロキシ等を用いたリクエストサイズ制限等の
|
|
188
|
+
緩和策を適用してください。
|
|
189
|
+
MSG
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Fluentd: SSRF via ${endpoint} in http output plugin
|
|
193
|
+
@rules << Rule.new('match', 'http') { |element| element['endpoint']&.match?(%r[https?://[^/]*\$\{]) }.register_report_message do |element|
|
|
194
|
+
<<~"MSG"
|
|
195
|
+
# Server-Side Request Forgery (SSRF) via Placeholder Expansion in out_http
|
|
196
|
+
* Severity: Moderate
|
|
197
|
+
* CVSS Score: 5.8
|
|
198
|
+
* Location: <#{element.name}> - @type #{element['@type']}
|
|
199
|
+
* Description:
|
|
200
|
+
* EN: When out_http determines destination servers for data transmission based on tags, this vulnerability
|
|
201
|
+
allows attackers to manipulate data transmission by sending crafted data, resulting in data being sent
|
|
202
|
+
to servers other than the intended ones.
|
|
203
|
+
* JA: out_httpでデータを別のサーバーに送る際の送信先をタグから決定している場合、細工したデータを送りつけられると、
|
|
204
|
+
本来の意図とは異なるサーバーへとデータを送信してしまうことが可能な脆弱性です。
|
|
205
|
+
* Workaround:
|
|
206
|
+
* EN: If you cannot immediately update the package, apply mitigation measures such as:
|
|
207
|
+
* not dynamically setting hostnames with placeholders
|
|
208
|
+
* restricting access from untrusted networks
|
|
209
|
+
* allowing only specific hosts
|
|
210
|
+
* JA: すぐにパッケージを更新できない場合、プレースホルダーでホスト名を動的に設定しない、信頼できない
|
|
211
|
+
ネットワークからのアクセスの制限、特定のホストのみ許可するなどの緩和策を適用してください。
|
|
212
|
+
MSG
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def validate(config_path)
|
|
217
|
+
parsed_config = Fluent::Config.build(config_path: config_path, type: :guess)
|
|
218
|
+
|
|
219
|
+
parsed_config.elements.each do |element|
|
|
220
|
+
check_element(element)
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
private
|
|
225
|
+
|
|
226
|
+
def check_element(element)
|
|
227
|
+
@rules.each do |rule|
|
|
228
|
+
unless rule.safe?(element)
|
|
229
|
+
@vulnerabilities += 1
|
|
230
|
+
puts rule.report(element)
|
|
231
|
+
puts "=" * 115
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
element.elements.each do |child|
|
|
236
|
+
check_element(child)
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<match **>
|
|
2
|
+
@type file
|
|
3
|
+
path /tmp/fluent/test.log
|
|
4
|
+
|
|
5
|
+
<buffer>
|
|
6
|
+
@type file
|
|
7
|
+
path /tmp/fluent/${tag}/buffer
|
|
8
|
+
</buffer>
|
|
9
|
+
</match>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<match **>
|
|
13
|
+
@type file
|
|
14
|
+
path /tmp/fluent/test.log
|
|
15
|
+
|
|
16
|
+
<buffer file>
|
|
17
|
+
@type file
|
|
18
|
+
path /tmp/fluent/${file}/buffer
|
|
19
|
+
</buffer>
|
|
20
|
+
</match>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<match **>
|
|
2
|
+
@type file
|
|
3
|
+
path /tmp/fluent/${tag}/test.log
|
|
4
|
+
|
|
5
|
+
<buffer>
|
|
6
|
+
@type file
|
|
7
|
+
path /tmp/fluent/buffer
|
|
8
|
+
</buffer>
|
|
9
|
+
</match>
|
|
10
|
+
|
|
11
|
+
<match **>
|
|
12
|
+
@type file
|
|
13
|
+
path /tmp/fluent/${file}/test.log
|
|
14
|
+
|
|
15
|
+
<buffer file>
|
|
16
|
+
@type file
|
|
17
|
+
path /tmp/fluent/buffer
|
|
18
|
+
</buffer>
|
|
19
|
+
</match>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<match **>
|
|
2
|
+
@type file
|
|
3
|
+
path /tmp/fluent/test.log
|
|
4
|
+
|
|
5
|
+
<buffer>
|
|
6
|
+
@type file
|
|
7
|
+
path /tmp/fluent/buffer
|
|
8
|
+
</buffer>
|
|
9
|
+
|
|
10
|
+
<secondary>
|
|
11
|
+
@type secondary_file
|
|
12
|
+
directory log/secondary/${file}
|
|
13
|
+
basename ${tag}_%Y%m%d%L_${message}
|
|
14
|
+
</secondary>
|
|
15
|
+
</match>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<match **>
|
|
2
|
+
@type forward
|
|
3
|
+
path /tmp/fluent/test.log
|
|
4
|
+
|
|
5
|
+
<buffer>
|
|
6
|
+
@type file
|
|
7
|
+
path /tmp/fluent/buffer
|
|
8
|
+
</buffer>
|
|
9
|
+
|
|
10
|
+
<server>
|
|
11
|
+
host 127.0.0.1
|
|
12
|
+
port 24224
|
|
13
|
+
</server>
|
|
14
|
+
|
|
15
|
+
<secondary>
|
|
16
|
+
@type file
|
|
17
|
+
path /tmp/fluent/${file}/secondary
|
|
18
|
+
|
|
19
|
+
<buffer>
|
|
20
|
+
@type file
|
|
21
|
+
path /tmp/fluent/secondary_buffer
|
|
22
|
+
</buffer>
|
|
23
|
+
</secondary>
|
|
24
|
+
</match>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
config:
|
|
2
|
+
# Exposure of Sensitive Information via Monitor Agent API
|
|
3
|
+
- source:
|
|
4
|
+
$type: monitor_agent
|
|
5
|
+
port: 24220
|
|
6
|
+
|
|
7
|
+
# Denial of Service (DoS) via Gzip Decompression Bomb in `in_http` and `in_forward`
|
|
8
|
+
- source:
|
|
9
|
+
$type: http
|
|
10
|
+
port: 9880
|
|
11
|
+
bind: 0.0.0.0
|
|
12
|
+
|
|
13
|
+
# Server-Side Request Forgery (SSRF) via Placeholder Expansion in `out_http`
|
|
14
|
+
- match:
|
|
15
|
+
$tag: web.**
|
|
16
|
+
$type: http
|
|
17
|
+
endpoint: http://${tag}.internal.example.com/api/logs
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
require "test-unit"
|
|
2
|
+
require "fluent/vulnerability_checker"
|
|
3
|
+
|
|
4
|
+
class Fluent::VulnerabilityCheckerTest < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
def path(path)
|
|
7
|
+
File.expand_path(File.join(File.dirname(__FILE__), path))
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
sub_test_case "Remote Code Execution (RCE) via Arbitrary File Write in `${tag}` Placeholder " do
|
|
11
|
+
test "detect vulnerability in out_file config" do
|
|
12
|
+
config_path = path("./resources/unsafe/remote_code_execution_out_file.conf")
|
|
13
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
14
|
+
checker.validate(config_path)
|
|
15
|
+
|
|
16
|
+
assert_equal(2, checker.vulnerabilities)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
test "detect vulnerability in buffer_file config" do
|
|
20
|
+
config_path = path("./resources/unsafe/remote_code_execution_buffer_file.conf")
|
|
21
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
22
|
+
checker.validate(config_path)
|
|
23
|
+
|
|
24
|
+
assert_equal(2, checker.vulnerabilities)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
test "detect vulnerability in out_file in secondary section" do
|
|
28
|
+
config_path = path("./resources/unsafe/remote_code_execution_secondary_out_file.conf")
|
|
29
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
30
|
+
checker.validate(config_path)
|
|
31
|
+
|
|
32
|
+
assert_equal(1, checker.vulnerabilities)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
test "detect vulnerability in out_file in store section" do
|
|
36
|
+
config_path = path("./resources/unsafe/remote_code_execution_store_out_file.conf")
|
|
37
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
38
|
+
checker.validate(config_path)
|
|
39
|
+
|
|
40
|
+
assert_equal(1, checker.vulnerabilities)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
test "detect vulnerability in out_secondary_file" do
|
|
44
|
+
config_path = path("./resources/unsafe/remote_code_execution_out_secondary_file.conf")
|
|
45
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
46
|
+
checker.validate(config_path)
|
|
47
|
+
|
|
48
|
+
assert_equal(1, checker.vulnerabilities)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
test "no detect vulnerability with safe config" do
|
|
52
|
+
config_path = path("./resources/safe/out_file_buffer_file.conf")
|
|
53
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
54
|
+
checker.validate(config_path)
|
|
55
|
+
|
|
56
|
+
assert_equal(0, checker.vulnerabilities)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
sub_test_case "Exposure of Sensitive Information via Monitor Agent API" do
|
|
61
|
+
test "detect vulnerability" do
|
|
62
|
+
config_path = path("./resources/unsafe/exposure_of_sensitive_information.conf")
|
|
63
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
64
|
+
checker.validate(config_path)
|
|
65
|
+
|
|
66
|
+
assert_equal(2, checker.vulnerabilities)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
test "no detect vulnerability with safe config" do
|
|
70
|
+
config_path = path("./resources/safe/in_monitor_agent.conf")
|
|
71
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
72
|
+
checker.validate(config_path)
|
|
73
|
+
|
|
74
|
+
assert_equal(0, checker.vulnerabilities)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
sub_test_case "Denial of Service (DoS) via Gzip Decompression Bomb in `in_http` and `in_forward` " do
|
|
79
|
+
test "detect vulnerability in in_http config" do
|
|
80
|
+
config_path = path("./resources/unsafe/dos_in_http.conf")
|
|
81
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
82
|
+
checker.validate(config_path)
|
|
83
|
+
|
|
84
|
+
assert_equal(1, checker.vulnerabilities)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
test "detect vulnerability in in_forward config" do
|
|
88
|
+
config_path = path("./resources/unsafe/dos_in_forward.conf")
|
|
89
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
90
|
+
checker.validate(config_path)
|
|
91
|
+
|
|
92
|
+
assert_equal(1, checker.vulnerabilities)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
sub_test_case "Denial of Service (DoS) via Decompression Bomb in `in_s3`" do
|
|
97
|
+
test "detect vulnerability" do
|
|
98
|
+
config_path = path("./resources/unsafe/dos_in_s3.conf")
|
|
99
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
100
|
+
checker.validate(config_path)
|
|
101
|
+
|
|
102
|
+
assert_equal(1, checker.vulnerabilities)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
sub_test_case "Denial of Service (DoS) via Large Payloads and Decompression Bombs in `in_opentelemetry`" do
|
|
107
|
+
test "detect vulnerability in in_opentelemetry config" do
|
|
108
|
+
config_path = path("./resources/unsafe/dos_in_opentelemetry.conf")
|
|
109
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
110
|
+
checker.validate(config_path)
|
|
111
|
+
|
|
112
|
+
assert_equal(1, checker.vulnerabilities)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
sub_test_case "Server-Side Request Forgery (SSRF) via Placeholder Expansion in `out_http`" do
|
|
117
|
+
test "detect vulnerability in out_http config" do
|
|
118
|
+
config_path = path("./resources/unsafe/ssrf_out_http.conf")
|
|
119
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
120
|
+
checker.validate(config_path)
|
|
121
|
+
|
|
122
|
+
assert_equal(1, checker.vulnerabilities)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
test "no detect vulnerability with safe config" do
|
|
126
|
+
config_path = path("./resources/safe/out_http.conf")
|
|
127
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
128
|
+
checker.validate(config_path)
|
|
129
|
+
|
|
130
|
+
assert_equal(0, checker.vulnerabilities)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
test "YAML format" do
|
|
135
|
+
config_path = path("./resources/unsafe/test_vulnerable.yaml")
|
|
136
|
+
checker = Fluent::VulnerabilityChecker.new
|
|
137
|
+
checker.validate(config_path)
|
|
138
|
+
|
|
139
|
+
assert_equal(3, checker.vulnerabilities)
|
|
140
|
+
end
|
|
141
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fluent-vulnerability_checker
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Shizuo Fujita
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: fluentd
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
description: A security scanner and vulnerability checker for Fluentd configuration
|
|
27
|
+
files.
|
|
28
|
+
email:
|
|
29
|
+
- fujita@clear-code.com
|
|
30
|
+
executables:
|
|
31
|
+
- fluent-vulnerabilitycheck
|
|
32
|
+
extensions: []
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- ".github/dependabot.yml"
|
|
36
|
+
- ".github/workflows/linux.yml"
|
|
37
|
+
- ".github/workflows/windows.yml"
|
|
38
|
+
- ".rubocop.yml"
|
|
39
|
+
- LICENSE
|
|
40
|
+
- README.md
|
|
41
|
+
- Rakefile
|
|
42
|
+
- exe/fluent-vulnerabilitycheck
|
|
43
|
+
- lib/fluent/vulnerability_checker.rb
|
|
44
|
+
- test/fluent/resources/safe/in_monitor_agent.conf
|
|
45
|
+
- test/fluent/resources/safe/out_file_buffer_file.conf
|
|
46
|
+
- test/fluent/resources/safe/out_http.conf
|
|
47
|
+
- test/fluent/resources/unsafe/dos_in_forward.conf
|
|
48
|
+
- test/fluent/resources/unsafe/dos_in_http.conf
|
|
49
|
+
- test/fluent/resources/unsafe/dos_in_opentelemetry.conf
|
|
50
|
+
- test/fluent/resources/unsafe/dos_in_s3.conf
|
|
51
|
+
- test/fluent/resources/unsafe/exposure_of_sensitive_information.conf
|
|
52
|
+
- test/fluent/resources/unsafe/remote_code_execution_buffer_file.conf
|
|
53
|
+
- test/fluent/resources/unsafe/remote_code_execution_out_file.conf
|
|
54
|
+
- test/fluent/resources/unsafe/remote_code_execution_out_secondary_file.conf
|
|
55
|
+
- test/fluent/resources/unsafe/remote_code_execution_secondary_out_file.conf
|
|
56
|
+
- test/fluent/resources/unsafe/remote_code_execution_store_out_file.conf
|
|
57
|
+
- test/fluent/resources/unsafe/ssrf_out_http.conf
|
|
58
|
+
- test/fluent/resources/unsafe/test_vulnerable.yaml
|
|
59
|
+
- test/fluent/test_vulnerability_checker.rb
|
|
60
|
+
homepage: https://www.fluentd.org/
|
|
61
|
+
licenses: []
|
|
62
|
+
metadata:
|
|
63
|
+
homepage_uri: https://www.fluentd.org/
|
|
64
|
+
rubygems_mfa_required: 'true'
|
|
65
|
+
rdoc_options: []
|
|
66
|
+
require_paths:
|
|
67
|
+
- lib
|
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
|
+
requirements:
|
|
70
|
+
- - ">="
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: 2.7.0
|
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
|
+
requirements:
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
requirements: []
|
|
79
|
+
rubygems_version: 4.0.15
|
|
80
|
+
specification_version: 4
|
|
81
|
+
summary: A security scanner and vulnerability checker for Fluentd configuration files.
|
|
82
|
+
test_files: []
|