Project: KICS (Provisioning / Security & Compliance)
File: 06b9f52a-8cd5-459b-bdc6-21a22521e1be.md

title: Directory Service Microsoft AD Password Set to Plaintext or Default Ref hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 06b9f52a-8cd5-459b-bdc6-21a22521e1be Query name: Directory Service Microsoft AD Password Set to Plaintext or Default Ref Platform: CloudFormation Severity: <span style="color:#bb2124">High</span> Category: Secret Management URL: Directory Service Microsoft AD password must not be a plaintext string or a Ref to a Parameter with a Default value.<br> ```yaml title="Positive test num. 1 - yaml file" hl_lines="14" Parameters: ParentMasterUsername: Description: 'username' Type: String Default: 'username!' Resources: NewAmpApp-2: Type: AWS::DirectoryService::MicrosoftAD Properties: CreateAlias: true Edition: String EnableSso: true Name: String Password: 'asDjskjs73!!' ShortName: String ``` ```yaml title="Positive test num. 2 - yaml file" hl_lines="9" Resources: NewAmpApp: Type: AWS::DirectoryService::MicrosoftAD Properties: CreateAlias: true Edition: String EnableSso: true Name: String Password: 'asDjskjs73!!' ShortName: String ``` ```yaml title="Positive test num. 3 - yaml file" hl_lines="5" Parameters: ParentMasterPassword: Description: 'Password' Type: String Default: 'asDjskjs73!' ParentMasterUsername: Description: 'username' Type: String Default: 'username!' Resources: NewAmpApp-1: Type: AWS::DirectoryService::MicrosoftAD Properties: CreateAlias: true EnableSso: true Edition: String Name: String Password: !Ref ParentMasterPassword ShortName: String ``` <details><summary>Positive test num. 4 - json file</summary> ```json hl_lines="17" { "Parameters": { "ParentMasterUsername": { "Description": "username", "Type": "String", "Default": "username!" } }, "Resources": { "NewAmpApp-2": { "Type": "AWS::DirectoryService::MicrosoftAD", "Properties": { "CreateAlias": true, "Edition": "String", "EnableSso": true, "Name": "String", "Password": "asDjskjs73!!", "ShortName": "String" } } } } ``` </details> <details><summary>Positive test num. 5 - json file</summary> ```json hl_lines="11" { "Resources": { "NewAmpApp": { "Type": "AWS::DirectoryService::MicrosoftAD", "Properties": { "ShortName": "String", "CreateAlias": true, "Edition": "String", "EnableSso": true, "Name": "String", "Password": "asDjskjs73!!" } } } } ``` </details> <details><summary>Positive test

6 - json file</summary> ```json hl_lines="5" { "Parameters": { "ParentMasterPassword": { "Type": "String", "Default": "asDjskjs73!", "Description": "Password" }, "ParentMasterUsername": { "Description": "username", "Type": "String", "Default": "username!" } }, "Resources": { "NewAmpApp-1": { "Type": "AWS::DirectoryService::MicrosoftAD", "Properties": { "Edition": "String", "Name": "String", "Password": "ParentMasterPassword", "ShortName": "String", "CreateAlias": true, "EnableSso": true } } } } ``` </details> ```yaml title="Negative test num. 1 - yaml file" Parameters: ParentMasterPassword: Description: 'Password' Type: String Default: '' ParentMasterUsername: Description: 'username' Type: String Default: 'username!' Resources: NewAmpApp-1: Type: AWS::DirectoryService::MicrosoftAD Properties: CreateAlias: true Edition: String EnableSso: true Name: String Password: !Ref ParentMasterPassword ShortName: String ``` ```yaml title="Negative test num. 2 - yaml file" Parameters: ParentMasterPassword: Description: 'Password' Type: String ParentMasterUsername: Description: 'username' Type: String Default: 'username' Resources: NewAmpApp-1: Type: AWS::DirectoryService::MicrosoftAD Properties: CreateAlias: true Edition: String EnableSso: true Name: String Password: !Ref ParentMasterPassword ShortName: String ``` ```yaml title="Negative test num. 3 - yaml file" Resources: NewAmpApp-2: Type: AWS::DirectoryService::MicrosoftAD Properties: CreateAlias: true Edition: String EnableSso: true Name: String Password: !Sub '{{resolve:secretsmanager:${MyAmpAppSecretManagerRotater}::password}}' ShortName: String MyAmpAppSecretManagerRotater: Type: AWS::SecretsManager::Secret Properties: Description: 'This is my amp app instance secret' GenerateSecretString: SecretStringTemplate: '{"username": "admin"}' GenerateStringKey: 'password' PasswordLength: 16 ExcludeCharacters: '"@/\' ``` <details><summary>Negative test num. 4 - json file</summary> ```json { "Parameters": { "ParentMasterPassword": { "Description": "Password", "Type": "String", "Default": "" }, "ParentMasterUsername": { "Description": "username", "Type": "String", "Default": "username!" } }, "Resources": { "NewAmpApp-1": { "Type": "AWS::DirectoryService::MicrosoftAD", "Properties": { "ShortName": "String", "CreateAlias": true, "Edition": "String", "EnableSso": true, "Name": "String", "Password": "ParentMasterPassword" } } } } ``` </details> <details><summary>Negative test num. 5 - json file</summary> ```json { "Parameters": { "ParentMasterPassword": { "Description": "Password", "Type": "String" }, "ParentMasterUsername": { "Type": "String", "Default": "username", "Description": "username" } }, "Resources": { "NewAmpApp-1": { "Type": "AWS::DirectoryService::MicrosoftAD", "Properties": { "CreateAlias": true, "Edition": "String", "EnableSso": true, "Name": "String", "Password": "ParentMasterPassword", "ShortName": "String" } } } } ``` </details> <details><summary>Negative test num. 6 - json file</summary> ```json { "Resources": { "NewAmpApp-2": { "Properties": { "CreateAlias": true, "Edition": "String", "EnableSso": true, "Name": "String", "Password": "{{resolve:secretsmanager:${MyAmpAppSecretManagerRotater}::password}}", "ShortName": "String" }, "Type": "AWS::DirectoryService::MicrosoftAD" }, "MyAmpAppSecretManagerRotater": { "Properties": { "Description": "This is my amp app instance secret", "GenerateSecretString": { "SecretStringTemplate": "{\"username\": \"admin\"}", "GenerateStringKey": "password", "PasswordLength": 16, "ExcludeCharacters": "\"@/\\" } }, "Type": "AWS::SecretsManager::Secret" } } } ``` </details>