From a28250be190f18f43dd4417a914dbaff7d0294ef Mon Sep 17 00:00:00 2001 From: Mick Grove Date: Sun, 29 Mar 2026 00:03:58 -0700 Subject: [PATCH] added more rules --- NOTICE | 35 ++++++++ .../data/rules/octopusdeploy.yml | 66 ++++++++++++++ .../kingfisher-rules/data/rules/openshift.yml | 78 +++++++++++++++++ .../data/rules/polymarket.yml | 85 +++++++++++++++++++ .../kingfisher-rules/data/rules/privateai.yml | 58 +++++++++++++ .../kingfisher-rules/data/rules/privkey.yml | 19 +++++ .../data/rules/settlemint.yml | 63 ++++++++++++++ .../kingfisher-rules/data/rules/sidekiq.yml | 58 +++++++++++++ 8 files changed, 462 insertions(+) create mode 100644 crates/kingfisher-rules/data/rules/octopusdeploy.yml create mode 100644 crates/kingfisher-rules/data/rules/openshift.yml create mode 100644 crates/kingfisher-rules/data/rules/polymarket.yml create mode 100644 crates/kingfisher-rules/data/rules/privateai.yml create mode 100644 crates/kingfisher-rules/data/rules/settlemint.yml create mode 100644 crates/kingfisher-rules/data/rules/sidekiq.yml diff --git a/NOTICE b/NOTICE index 6116057..f47f0bb 100644 --- a/NOTICE +++ b/NOTICE @@ -78,3 +78,38 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +-------------------------------------------------------------------- + +Certain detection rules: + * crates/kingfisher-rules/data/rules/octopusdeploy.yml + * crates/kingfisher-rules/data/rules/openshift.yml + * crates/kingfisher-rules/data/rules/polymarket.yml + * crates/kingfisher-rules/data/rules/privateai.yml + * crates/kingfisher-rules/data/rules/settlemint.yml + * crates/kingfisher-rules/data/rules/sidekiq.yml + +are derived in part from Betterleaks +(https://github.com/betterleaks/betterleaks), which is licensed under the MIT +License. + +Betterleaks +Copyright (c) 2026 Zachary Rice + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/crates/kingfisher-rules/data/rules/octopusdeploy.yml b/crates/kingfisher-rules/data/rules/octopusdeploy.yml new file mode 100644 index 0000000..b834bdb --- /dev/null +++ b/crates/kingfisher-rules/data/rules/octopusdeploy.yml @@ -0,0 +1,66 @@ +rules: + - name: Octopus Deploy Server URL + id: kingfisher.octopusdeploy.1 + pattern: | + (?xi) + (?: + \boctopus(?:[_\s.-]?deploy)?(?:[_\s.-]?(?:url|server|host))?\b + (?:.|[\n\r]){0,32}? + [:=] + | + \boctopus(?:url|server|host)\b + \s*[:=] + ) + \s*["']? + ( + https:// + [A-Za-z0-9.-]+ + (?::\d{2,5})? + ) + ["']? + min_entropy: 2.3 + confidence: medium + visible: false + examples: + - OCTOPUS_URL=https://deploy.acme.example + - 'octopus_server: "https://octopus.internal.example:8443"' + references: + - https://octopus.com/docs/octopus-rest-api/getting-started + + - name: Octopus Deploy API Key + id: kingfisher.octopusdeploy.2 + pattern: | + (?x) + \b + ( + API-[A-Z0-9]{26} + ) + \b + pattern_requirements: + min_digits: 4 + min_uppercase: 4 + min_entropy: 3.4 + confidence: medium + examples: + - OCTOPUS_API_KEY=API-ZNRMR7SL6L3ATMOIK7GKJDKLPY + - 'set apikey="API-A1B2C3D4E5F6G7H8J9K0LMNOPQ"' + references: + - https://octopus.com/docs/octopus-rest-api/getting-started + - https://octopus.com/docs/octopus-rest-api/how-to-create-an-api-key + depends_on_rule: + - rule_id: kingfisher.octopusdeploy.1 + variable: OCTOPUS_URL + validation: + type: Http + content: + request: + method: GET + url: '{{ OCTOPUS_URL }}/api' + headers: + X-Octopus-ApiKey: '{{ TOKEN }}' + Accept: application/json + response_matcher: + - report_response: true + - type: StatusMatch + status: [200] + - type: JsonValid diff --git a/crates/kingfisher-rules/data/rules/openshift.yml b/crates/kingfisher-rules/data/rules/openshift.yml new file mode 100644 index 0000000..442c27b --- /dev/null +++ b/crates/kingfisher-rules/data/rules/openshift.yml @@ -0,0 +1,78 @@ +rules: + - name: OpenShift API Server URL + id: kingfisher.openshift.1 + pattern: | + (?xi) + (?: + \boc\s+login\b + (?:.|[\n\r]){0,128}? + --server= + | + \bopenshift\b + (?:.|[\n\r]){0,32}? + \b(?:server|api(?:[_-]?server)?|cluster(?:[_-]?url)?)\b + \s*[:=]\s* + ) + ["']? + ( + https:// + (?: + \[[0-9a-f:.]+\] + | + [a-z0-9] + [a-z0-9.-]{1,253} + ) + (?::\d{2,5})? + ) + ["']? + min_entropy: 2.0 + confidence: medium + visible: false + examples: + - oc login --token=sha256~kV46hPnEYhCWFnB85r5NrprAxggzgb6GOeLbgcKNsH0 --server=https://api.cluster.example.com:6443 + - OPENSHIFT_SERVER=https://api.dev-cluster.example.net:6443 + references: + - https://docs.redhat.com/en/documentation/openshift_container_platform/4.9/html-single/authentication_and_authorization/index + - https://docs.redhat.com/en/documentation/openshift_container_platform/4.17/html/user_and_group_apis/user-user-openshift-io-v1 + + - name: OpenShift OAuth Access Token + id: kingfisher.openshift.2 + pattern: | + (?x) + \b + ( + sha256~[A-Za-z0-9_-]{43} + ) + \b + pattern_requirements: + min_digits: 3 + min_uppercase: 1 + min_lowercase: 3 + ignore_if_contains: + - put_your_token_here + - xxxxxx + min_entropy: 3.8 + confidence: medium + examples: + - 'Authorization: Bearer sha256~kV46hPnEYhCWFnB85r5NrprAxggzgb6GOeLbgcKNsH0' + - oc login --token=sha256~ZBMKw9VAayhdnyANaHvjJeXDiGwA7Fsr5gtLKj3-eh- --server=https://api.cluster.example.com:6443 + references: + - https://docs.redhat.com/en/documentation/openshift_container_platform/4.17/html/oauth_apis/oauthaccesstoken-oauth-openshift-io-v1 + - https://docs.redhat.com/en/documentation/openshift_container_platform/4.9/html-single/authentication_and_authorization/index + depends_on_rule: + - rule_id: kingfisher.openshift.1 + variable: OPENSHIFT_API_SERVER + validation: + type: Http + content: + request: + method: GET + url: '{{ OPENSHIFT_API_SERVER }}/apis/user.openshift.io/v1/users' + headers: + Authorization: 'Bearer {{ TOKEN }}' + Accept: application/json + response_matcher: + - report_response: true + - type: StatusMatch + status: [200, 403] + - type: JsonValid diff --git a/crates/kingfisher-rules/data/rules/polymarket.yml b/crates/kingfisher-rules/data/rules/polymarket.yml new file mode 100644 index 0000000..fd32d71 --- /dev/null +++ b/crates/kingfisher-rules/data/rules/polymarket.yml @@ -0,0 +1,85 @@ +rules: + - name: Polymarket Builder Secret + id: kingfisher.polymarket.1 + pattern: | + (?xi) + \b + poly(?:market)? + (?:.|[\n\r]){0,32}? + (?:builder|api)? + (?:.|[\n\r]){0,16}? + secret + (?:.|[\n\r]){0,12}? + ( + [A-Za-z0-9+/]{40,88}={0,2} + ) + \b + pattern_requirements: + min_digits: 2 + min_uppercase: 1 + min_lowercase: 8 + min_entropy: 3.6 + confidence: medium + visible: false + examples: + - POLY_BUILDER_SECRET=QmFzZTY0U2VjcmV0VGVzdEtleTEyMzQ1Njc4OTBBQkNERUY= + - 'polymarket_builder_secret: Q29tcGxleFNlY3JldE1hdGVyaWFsMTIzNDU2Nzg5MDEyMzQ=' + references: + - https://docs.polymarket.com/trading/orders/attribution + + - name: Polymarket Builder Passphrase + id: kingfisher.polymarket.2 + pattern: | + (?xi) + \b + poly(?:market)? + (?:.|[\n\r]){0,32}? + (?:builder|api)? + (?:.|[\n\r]){0,16}? + passphrase + (?:.|[\n\r]){0,12}? + ( + [A-Za-z0-9_]{8,128} + ) + \b + pattern_requirements: + min_digits: 1 + min_uppercase: 1 + min_lowercase: 4 + ignore_if_contains: + - example + - placeholder + min_entropy: 3.0 + confidence: medium + visible: false + examples: + - POLY_BUILDER_PASSPHRASE=BuilderPass_2026 + - 'polymarket_passphrase: AlphaPass_7788' + references: + - https://docs.polymarket.com/trading/orders/attribution + + - name: Polymarket Builder API Key + id: kingfisher.polymarket.3 + pattern: | + (?xi) + \b + poly(?:market)? + (?:.|[\n\r]){0,32}? + (?:builder|api)? + (?:.|[\n\r]){0,16}? + key + (?:.|[\n\r]){0,12}? + ( + [a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12} + ) + \b + pattern_requirements: + min_digits: 6 + min_lowercase: 8 + min_entropy: 3.2 + confidence: medium + examples: + - POLY_BUILDER_API_KEY=12345678-abcd-1234-efab-1234567890ab + - 'polymarket_api_key: a1b2c3d4-e5f6-789a-bcde-f0123456789a' + references: + - https://docs.polymarket.com/trading/orders/attribution diff --git a/crates/kingfisher-rules/data/rules/privateai.yml b/crates/kingfisher-rules/data/rules/privateai.yml new file mode 100644 index 0000000..ce7d5d6 --- /dev/null +++ b/crates/kingfisher-rules/data/rules/privateai.yml @@ -0,0 +1,58 @@ +rules: + - name: Private AI API Key + id: kingfisher.privateai.1 + pattern: | + (?xi) + \b + (?: + private[_-]?ai + | + limina + ) + (?:.|[\n\r]){0,32}? + (?: + api[_-]?key + | + x-api-key + | + token + ) + (?:.|[\n\r]){0,12}? + ( + [a-z0-9]{32} + ) + \b + pattern_requirements: + min_digits: 4 + min_lowercase: 8 + ignore_if_contains: + - example + - placeholder + - insert + - your + min_entropy: 3.5 + confidence: medium + examples: + - PRIVATEAI_API_KEY=4fa2d7c81be9063d4ea8bc1f6d2a7e9c + - 'x-api-key: 2ab4d6e8f0c1a3b5d7e9f1a2b4c6d8e0' + references: + - https://docs.private-ai.com/fundamentals/getting-started + - https://docs.private-ai.com/reference/4.0.0/operation/ner_text_ner_text_post/ + validation: + type: Http + content: + request: + method: POST + url: https://api.private-ai.com/community/v4/process/text + headers: + Content-Type: application/json + x-api-key: '{{ TOKEN }}' + body: '{"text":["Hello Jane Doe"]}' + response_matcher: + - report_response: true + - type: StatusMatch + status: [200] + - type: JsonValid + - type: WordMatch + words: + - '"processed_text"' diff --git a/crates/kingfisher-rules/data/rules/privkey.yml b/crates/kingfisher-rules/data/rules/privkey.yml index e6fa5e9..8407324 100644 --- a/crates/kingfisher-rules/data/rules/privkey.yml +++ b/crates/kingfisher-rules/data/rules/privkey.yml @@ -108,3 +108,22 @@ rules: -----END ENCRYPTED PRIVATE KEY BLOCK----- references: - https://www.rfc-editor.org/rfc/rfc7468 + + - name: PKCS#12 File Path + id: kingfisher.privkey.3 + pattern: | + (?xi) + (?: + ^|["'\s(=/] + ) + ( + (?:[^"' \t\r\n/]+/)*[^"' \t\r\n/]+\.(?:p12|pfx) + ) + (?: + $|["'\s),] + ) + min_entropy: 2.0 + confidence: medium + examples: + - security/es_certificates/opensearch/es_kibana_client.p12 + - ToDo/ToDo.UWP/ToDo.UWP_TemporaryKey.pfx diff --git a/crates/kingfisher-rules/data/rules/settlemint.yml b/crates/kingfisher-rules/data/rules/settlemint.yml new file mode 100644 index 0000000..2c38e29 --- /dev/null +++ b/crates/kingfisher-rules/data/rules/settlemint.yml @@ -0,0 +1,63 @@ +rules: + - name: SettleMint Personal Access Token + id: kingfisher.settlemint.1 + pattern: | + (?x) + \b + ( + sm_pat_[A-Za-z0-9]{16} + ) + \b + pattern_requirements: + min_digits: 2 + min_uppercase: 1 + min_lowercase: 4 + min_entropy: 3.2 + confidence: medium + examples: + - SETTLEMINT_ACCESS_TOKEN=sm_pat_A1b2C3d4E5f6G7h8 + - settlemint connect --pat=sm_pat_Z9y8X7w6V5u4T3s2 + references: + - https://console.settlemint.com/documentation/blockchain-platform/platform-components/security-and-authentication/personal-access-tokens + + - name: SettleMint Application Access Token + id: kingfisher.settlemint.2 + pattern: | + (?x) + \b + ( + sm_aat_[A-Za-z0-9]{16} + ) + \b + pattern_requirements: + min_digits: 2 + min_uppercase: 1 + min_lowercase: 4 + min_entropy: 3.2 + confidence: medium + examples: + - BLOCKSCOUT_SETTLEMINT_APPLICATION_ACCESS_TOKEN=sm_aat_A1b2C3d4E5f6G7h8 + - 'x-auth-token: sm_aat_Z9y8X7w6V5u4T3s2' + references: + - https://console.settlemint.com/documentation/blockchain-platform/platform-components/security-and-authentication/application-access-tokens + + - name: SettleMint Service Access Token + id: kingfisher.settlemint.3 + pattern: | + (?x) + \b + ( + sm_sat_[A-Za-z0-9]{16} + ) + \b + pattern_requirements: + min_digits: 2 + min_uppercase: 1 + min_lowercase: 4 + min_entropy: 3.2 + confidence: medium + examples: + - SETTLEMINT_SERVICE_TOKEN=sm_sat_A1b2C3d4E5f6G7h8 + - 'Authorization: Bearer sm_sat_Z9y8X7w6V5u4T3s2' + references: + - https://console.settlemint.com/documentation diff --git a/crates/kingfisher-rules/data/rules/sidekiq.yml b/crates/kingfisher-rules/data/rules/sidekiq.yml new file mode 100644 index 0000000..9e0eb2b --- /dev/null +++ b/crates/kingfisher-rules/data/rules/sidekiq.yml @@ -0,0 +1,58 @@ +rules: + - name: Sidekiq Enterprise Credential + id: kingfisher.sidekiq.1 + pattern: | + (?xi) + \b + (?: + BUNDLE_ENTERPRISE__CONTRIBSYS__COM + | + BUNDLE_GEMS__CONTRIBSYS__COM + ) + \s*[:=]\s* + ["']? + ( + [a-f0-9]{8}:[a-f0-9]{8} + ) + ["']? + \b + pattern_requirements: + min_digits: 4 + min_lowercase: 4 + min_entropy: 2.8 + confidence: medium + examples: + - BUNDLE_ENTERPRISE__CONTRIBSYS__COM=cafebabe:deadbeef + - 'export BUNDLE_GEMS__CONTRIBSYS__COM="cafeb4b3:d3adb33f"' + + - name: Sidekiq Sensitive URL + id: kingfisher.sidekiq.2 + pattern: | + (?xi) + ( + https?:// + [a-f0-9]{8}:[a-f0-9]{8} + @ + (?: + gems\.contribsys\.com + | + enterprise\.contribsys\.com + ) + (?: + /[^ \t\r\n"'<>]* + | + \?[^ \t\r\n"'<>]* + | + \#[^ \t\r\n"'<>]* + | + :[0-9]{1,5}(?:/[^ \t\r\n"'<>]*)? + )? + ) + pattern_requirements: + min_digits: 4 + min_lowercase: 4 + min_entropy: 2.8 + confidence: medium + examples: + - https://cafebabe:deadbeef@gems.contribsys.com/ + - http://cafeb4b3:d3adb33f@enterprise.contribsys.com:80/path?param1=true