-
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 new rule:
Connection String in .NET Configuration
(#238)
- Loading branch information
1 parent
e7d68c6
commit 14a2a39
Showing
7 changed files
with
80 additions
and
10 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 |
---|---|---|
|
@@ -1130,6 +1130,32 @@ expression: stdout | |
] | ||
} | ||
}, | ||
{ | ||
"id": "np.generic.10", | ||
"structural_id": "7139cc6e9cf6d7babcdd37a5183e95a9a3e6ccfc", | ||
"name": "Connection String in .NET Configuration", | ||
"syntax": { | ||
"name": "Connection String in .NET Configuration", | ||
"id": "np.generic.10", | ||
"pattern": "(?x)\n< \\s* add \\s+ key \\s* = \\s*\n \" (\n [^\\n\"]{0,20}\n (?: [Cc]onnection[Ss]tring | CONNECTIONSTRING )\n [^\\n\"]{0,20}\n ) \"\n\\s+\nvalue \\s* = \\s* \" ([^\\n\"]{3,200}) \" \\s* / \\s* >\n", | ||
"description": "A possibly-sensitive connection string in .NET app configuration was found. This may allow an attacker direct access to a database.\n", | ||
"examples": [ | ||
"<add key=\"ConnectionString_B2B\" value=\"Server=awsbman-t,1433;Database=B2B;User ID=b2buser;Password=#gets0m3;Trusted_Connection=False\" />\n" | ||
], | ||
"negative_examples": [ | ||
"<add key=\"FromEmailAddress\" value=\"[email protected]\"/>\n<add key=\"FromEmailPassword\" value=\"Prestigitariu$\"/>\n" | ||
], | ||
"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.generic.2", | ||
"structural_id": "ac1028729d342a4d0cf282377532d882a48795c6", | ||
|
@@ -1332,16 +1358,18 @@ expression: stdout | |
{ | ||
"id": "np.generic.9", | ||
"structural_id": "37dadc2ef09aa6f150315ce6f9aaebdf2d8b473b", | ||
"name": "Sensitive value in .NET configuration", | ||
"name": "Sensitive Value in .NET Configuration", | ||
"syntax": { | ||
"name": "Sensitive value in .NET configuration", | ||
"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": [], | ||
"negative_examples": [ | ||
"<add key=\"ConnectionString_B2B\" value=\"Server=awsbman-t,1433;Database=B2B;User ID=b2buser;Password=#gets0m3;Trusted_Connection=False\" />\n" | ||
], | ||
"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" | ||
|
@@ -4033,7 +4061,7 @@ expression: stdout | |
{ | ||
"id": "default", | ||
"name": "Nosey Parker default rules", | ||
"num_rules": 139 | ||
"num_rules": 140 | ||
}, | ||
{ | ||
"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 |
---|---|---|
|
@@ -331,7 +331,7 @@ rules: | |
This may allow an attacker access to an Active Directory instance. | ||
- name: Sensitive value in .NET configuration | ||
- name: Sensitive Value in .NET Configuration | ||
id: np.generic.9 | ||
pattern: | | ||
|
@@ -361,6 +361,45 @@ rules: | |
<add key="FromEmailAddress" value="[email protected]"/> | ||
<add key="FromEmailPassword" value="Prestigitariu$"/> | ||
negative_examples: | ||
- | | ||
<add key="ConnectionString_B2B" value="Server=awsbman-t,1433;Database=B2B;User ID=b2buser;Password=#gets0m3;Trusted_Connection=False" /> | ||
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 | ||
- name: Connection String in .NET Configuration | ||
id: np.generic.10 | ||
pattern: | | ||
(?x) | ||
< \s* add \s+ key \s* = \s* | ||
" ( | ||
[^\n"]{0,20} | ||
(?: [Cc]onnection[Ss]tring | CONNECTIONSTRING ) | ||
[^\n"]{0,20} | ||
) " | ||
\s+ | ||
value \s* = \s* " ([^\n"]{3,200}) " \s* / \s* > | ||
categories: [fuzzy, generic, secret] | ||
description: > | ||
A possibly-sensitive connection string in .NET app configuration was found. | ||
This may allow an attacker direct access to a database. | ||
examples: | ||
- | | ||
<add key="ConnectionString_B2B" value="Server=awsbman-t,1433;Database=B2B;User ID=b2buser;Password=#gets0m3;Trusted_Connection=False" /> | ||
negative_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