-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rule:
Sensitive value in .NET configuration
(#237)
- Loading branch information
1 parent
45ee29c
commit f5f5267
Showing
7 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1289,7 +1289,7 @@ expression: stdout | |
"name": "Credentials in .NET System.Net.NetworkCredential", | ||
"id": "np.generic.7", | ||
"pattern": "(?x)\n\\b\n(?: NetworkCredential | NETWORKCREDENTIAL | networkcredential )\n\\s* \\( \\s*\n \" ( [^\"\\n]{3,50} ) \" (?# username )\n \\s* , \\s*\n \" ( [^\"\\n]{3,50} ) \" (?# password )\n\\s* \\)\n", | ||
"description": "A .NET `System.Net.NetworkCredential` value with hardcoded parameters was found.\nThis may allow an attack access to a resource that uses basic, digest, NTLM, or Kerberos authentication.\n", | ||
"description": "A .NET `System.Net.NetworkCredential` value with hardcoded parameters was found. This may allow an attack access to a resource that uses basic, digest, NTLM, or Kerberos authentication.\n", | ||
"examples": [ | ||
"sender.Credentials = new NetworkCredential(\"[email protected]\", \"vzihlaquknriqlht\");\n", | ||
"$webClient.Credentials = new-object System.Net.NetworkCredential(\"cidownload\", \"AP7JaG9ToerxBc6gWP5LcU2CNpb\");\n" | ||
|
@@ -1313,7 +1313,7 @@ expression: stdout | |
"name": "Credentials in .NET System.DirectoryServices.DirectoryEntry", | ||
"id": "np.generic.8", | ||
"pattern": "(?x)\n\\b\n(?: DirectoryEntry | DIRECTORYENTRY | directoryentry )\n\\s* \\( \\s*\n \" ( [^\"\\n]{3,100} ) \" (?# path )\n \\s* , \\s*\n \" ( [^\"\\n]{3,50} ) \" (?# username )\n \\s* , \\s*\n \" ( [^\"\\n]{3,50} ) \" (?# password )\n (?: \\s* , \\s* [^)]{3,50} )? (?# authentication type )\n\\s* \\)\n", | ||
"description": "A .NET `System.DirectoryServices.DirectoryEntry` value was found with hardcoded credentials.\nThis may allow an attack access to an Active Directory instance.\n", | ||
"description": "A .NET `System.DirectoryServices.DirectoryEntry` value was found with hardcoded credentials. This may allow an attacker access to an Active Directory instance.\n", | ||
"examples": [ | ||
"$domain = New-Object DirectoryServices.DirectoryEntry(\"LDAP://10.10.10.1\",\"domain\\user\", \"secret\")\n", | ||
"new DirectoryEntry(\"LDAP://EXAMPLE.COM\",\n \"[email protected]\",\n \"Rrhh1234\");\n" | ||
|
@@ -1329,6 +1329,30 @@ expression: stdout | |
] | ||
} | ||
}, | ||
{ | ||
"id": "np.generic.9", | ||
"structural_id": "37dadc2ef09aa6f150315ce6f9aaebdf2d8b473b", | ||
"name": "Sensitive value in .NET configuration", | ||
"syntax": { | ||
"name": "Sensitive value in .NET configuration", | ||
"id": "np.generic.9", | ||
"pattern": "(?x)\n< \\s* add \\s+ key \\s* = \\s*\n \" (\n [^\\n\"]{0,20}\n (?: pass | Pass | PASS\n | secret | Secret | SECRET\n | user | User | USER\n | admin | Admin | ADMIN\n | token | Token | TOKEN\n )\n [^\\n\"]{0,20}\n ) \"\n\\s+\nvalue \\s* = \\s* \" ([^\\n\"]{3,100}) \" \\s* / \\s* >\n", | ||
"description": "A possibly-sensitive value in .NET app configuration was found. This may allow an attacker a way to bypass authentication or move laterally.\n", | ||
"examples": [ | ||
"<add key=\"FromEmailAddress\" value=\"[email protected]\"/>\n<add key=\"FromEmailPassword\" value=\"Prestigitariu$\"/>\n" | ||
], | ||
"negative_examples": [], | ||
"references": [ | ||
"https://learn.microsoft.com/en-us/dotnet/desktop/winforms/advanced/application-settings-overview", | ||
"https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/appsettings/appsettings-element-for-configuration" | ||
], | ||
"categories": [ | ||
"fuzzy", | ||
"generic", | ||
"secret" | ||
] | ||
} | ||
}, | ||
{ | ||
"id": "np.github.1", | ||
"structural_id": "f6c4fca24a1c7f275d51d2718a1585ca6e4ae664", | ||
|
@@ -4009,7 +4033,7 @@ expression: stdout | |
{ | ||
"id": "default", | ||
"name": "Nosey Parker default rules", | ||
"num_rules": 138 | ||
"num_rules": 139 | ||
}, | ||
{ | ||
"id": "np.assets", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,7 +291,7 @@ rules: | |
references: | ||
- https://learn.microsoft.com/en-us/dotnet/api/system.net.networkcredential | ||
description: | | ||
description: > | ||
A .NET `System.Net.NetworkCredential` value with hardcoded parameters was found. | ||
This may allow an attack access to a resource that uses basic, digest, NTLM, or Kerberos authentication. | ||
|
@@ -326,6 +326,41 @@ rules: | |
references: | ||
- https://learn.microsoft.com/en-us/dotnet/api/system.directoryservices.directoryentry | ||
description: | | ||
description: > | ||
A .NET `System.DirectoryServices.DirectoryEntry` value was found with hardcoded credentials. | ||
This may allow an attack access to an Active Directory instance. | ||
This may allow an attacker access to an Active Directory instance. | ||
- name: Sensitive value in .NET configuration | ||
id: np.generic.9 | ||
pattern: | | ||
(?x) | ||
< \s* add \s+ key \s* = \s* | ||
" ( | ||
[^\n"]{0,20} | ||
(?: pass | Pass | PASS | ||
| secret | Secret | SECRET | ||
| user | User | USER | ||
| admin | Admin | ADMIN | ||
| token | Token | TOKEN | ||
) | ||
[^\n"]{0,20} | ||
) " | ||
\s+ | ||
value \s* = \s* " ([^\n"]{3,100}) " \s* / \s* > | ||
categories: [fuzzy, generic, secret] | ||
description: > | ||
A possibly-sensitive value in .NET app configuration was found. | ||
This may allow an attacker a way to bypass authentication or move laterally. | ||
examples: | ||
- | | ||
<add key="FromEmailAddress" value="[email protected]"/> | ||
<add key="FromEmailPassword" value="Prestigitariu$"/> | ||
references: | ||
- https://learn.microsoft.com/en-us/dotnet/desktop/winforms/advanced/application-settings-overview | ||
- https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/appsettings/appsettings-element-for-configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters