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

Add ThingsBoard rule #112

Merged
merged 1 commit into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Doppler SCIM Token ([#111](https://github.com/praetorian-inc/noseyparker/pull/111))
- Doppler Audit Token ([#111](https://github.com/praetorian-inc/noseyparker/pull/111))
- Dropbox Access Token ([#106](https://github.com/praetorian-inc/noseyparker/pull/106))
- ThingsBoard Access Token ([#112](https://github.com/praetorian-inc/noseyparker/pull/112))
- ThingsBoard Provision Device Key ([#112](https://github.com/praetorian-inc/noseyparker/pull/112))
- ThingsBoard Provision Device Secret ([#112](https://github.com/praetorian-inc/noseyparker/pull/112))
- TrueNAS API Key (WebSocket) ([#110](https://github.com/praetorian-inc/noseyparker/pull/110))
- TrueNAS API Key (REST API) ([#110](https://github.com/praetorian-inc/noseyparker/pull/110))
- WireGuard Private Key ([#104](https://github.com/praetorian-inc/noseyparker/pull/104))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Nosey Parker is a command-line tool that finds secrets and sensitive information

**Key features:**
- It supports scanning files, directories, and the entire history of Git repositories
- It uses regular expression matching with a set of 126 patterns chosen for high signal-to-noise based on experience and feedback from offensive security engagements
- It uses regular expression matching with a set of 129 patterns chosen for high signal-to-noise based on experience and feedback from offensive security engagements
- It groups matches together that share the same secret, further emphasizing signal over noise
- It is fast: it can scan at hundreds of megabytes per second on a single core, and is able to scan 100GB of Linux kernel source history in less than 2 minutes on an older MacBook Pro

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
source: crates/noseyparker-cli/tests/rules/mod.rs
expression: stdout
---
126 rules and 3 rulesets: no issues detected
129 rules and 3 rulesets: no issues detected

Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,18 @@ expression: stdout
"id": "np.telegram.1",
"name": "Telegram Bot Token"
},
{
"id": "np.thingsboard.1",
"name": "ThingsBoard Access Token"
},
{
"id": "np.thingsboard.2",
"name": "ThingsBoard Provision Device Key"
},
{
"id": "np.thingsboard.3",
"name": "ThingsBoard Provision Device Secret"
},
{
"id": "np.truenas.1",
"name": "TrueNAS API Key (WebSocket)"
Expand Down Expand Up @@ -513,7 +525,7 @@ expression: stdout
{
"id": "default",
"name": "Nosey Parker default rules",
"num_rules": 106
"num_rules": 109
},
{
"id": "np.assets",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ expression: stdout
np.stripe.1 Stripe API Key
np.stripe.2 Stripe API Test Key
np.telegram.1 Telegram Bot Token
np.thingsboard.1 ThingsBoard Access Token
np.thingsboard.2 ThingsBoard Provision Device Key
np.thingsboard.3 ThingsBoard Provision Device Secret
np.truenas.1 TrueNAS API Key (WebSocket)
np.truenas.2 TrueNAS API Key (REST API)
np.twilio.1 Twilio API Key
Expand All @@ -134,7 +137,7 @@ expression: stdout

Ruleset ID Ruleset Name Rules
─────────────────────────────────────────────────────────
default Nosey Parker default rules 106
default Nosey Parker default rules 109
np.assets Nosey Parker asset detection rules 15
np.hashes Nosey Parker password hash rules 5

64 changes: 64 additions & 0 deletions crates/noseyparker/data/default/builtin/rules/thingsboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
rules:

# FIXME: add MQTT rule(s)
# - https://thingsboard.io/docs/paas/reference/mqtt-api/
# - https://thingsboard.io/docs/reference/mqtt-api/

# FIXME:
# The default access token follows the format [a-z0-9]{20}. However users may replace it with arbitrary tokens, provided they are between 1 and 32 characters in length.
# TODO: Update the regex pattern accordingly (currently it matches only the default format).
# After some research it appears that most (if not all) users utilize the default format so this is a low priority issue.

# FIXME:
# The default provision key/secret follows the format [a-z0-9]{20}. Users can replace it with arbitrary keys/secrets and there seems to be no length restriction.
# TODO: Update the regex patterns accordingly (currently they match only the default format).
# After some research it appears that most (if not all) users utilize the default format so this is a low priority issue.

- name: ThingsBoard Access Token
id: np.thingsboard.1

pattern: |
(?x)
thingsboard\.cloud/api/v1/
([a-z0-9]{20})

examples:
- http://thingsboard.cloud/api/v1/354u1g321kcqc1oad3w7/telemetry
gemesa marked this conversation as resolved.
Show resolved Hide resolved
- https://thingsboard.cloud/api/v1/354u1g321kcqc1oad3w7/telemetry
- coap://coap.thingsboard.cloud/api/v1/354u1g321kcqc1oad3w7/telemetry

references:
- https://thingsboard.io/docs/paas/reference/http-api/
- https://thingsboard.io/docs/paas/reference/coap-api/

- name: ThingsBoard Provision Device Key
id: np.thingsboard.2

pattern: |
(?x)
"provisionDeviceKey"\s*:\s*"
([a-z0-9]{20})
"

examples:
- '"{"deviceName": "DEVICE_NAME", "provisionDeviceKey": "s2s1gfcuatgbi61n8h5s", "provisionDeviceSecret": "xbzsovaw9ix4qfhi14an"}"'

references:
- https://thingsboard.io/docs/paas/reference/http-api/
- https://thingsboard.io/docs/paas/user-guide/device-provisioning/

- name: ThingsBoard Provision Device Secret
id: np.thingsboard.3

pattern: |
(?x)
"provisionDeviceSecret"\s*:\s*"
([a-z0-9]{20})
"

examples:
- '"{"deviceName": "DEVICE_NAME", "provisionDeviceKey": "s2s1gfcuatgbi61n8h5s", "provisionDeviceSecret": "xbzsovaw9ix4qfhi14an"}"'

references:
- https://thingsboard.io/docs/paas/reference/http-api/
- https://thingsboard.io/docs/paas/user-guide/device-provisioning/
3 changes: 3 additions & 0 deletions crates/noseyparker/data/default/builtin/rulesets/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ rulesets:
- np.stripe.1 # Stripe API Key
- np.stripe.2 # Stripe API Test Key
- np.telegram.1 # Telegram Bot Token
- np.thingsboard.1 # ThingsBoard Access Token
- np.thingsboard.2 # ThingsBoard Provision Device Key
- np.thingsboard.3 # ThingsBoard Provision Device Secret
- np.truenas.1 # TrueNAS API Key (WebSocket)
- np.truenas.2 # TrueNAS API Key (REST API)
- np.twilio.1 # Twilio API Key
Expand Down