Project: KICS (Provisioning / Security & Compliance)
File: b1b20ae3-8fa7-4af5-a74d-a2145920fcb1.md

title: IAM Password Without Minimum Length hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: b1b20ae3-8fa7-4af5-a74d-a2145920fcb1 Query name: IAM Password Without Minimum Length Platform: CloudFormation Severity: <span style="color:#edd57e">Low</span> Category: Best Practices URL: IAM password should have the required minimum length<br> ```yaml title="Positive test num. 1 - yaml file" hl_lines="9" AWSTemplateFormatVersion: "2010-09-09" Description: A sample template Resources: myuser: Type: AWS::IAM::User Properties: Path: "/" LoginProfile: Password: myP@ssW0rd Policies: PolicyName: giveaccesstoqueueonly PolicyDocument: Version: '2012-10-17' Statement: Effect: Allow Action: sqs:* Resource: !GetAtt myqueue.Arn Effect: Deny Action: sqs:* NotResource: !GetAtt myqueue.Arn PolicyName: giveaccesstotopiconly PolicyDocument: Version: '2012-10-17' Statement: Effect: Allow Action: sns:* Resource: !Ref mytopic Effect: Deny Action: sns:* NotResource: !Ref mytopic ``` ```json title="Positive test num. 2 - json file" hl_lines="10" { "AWSTemplateFormatVersion": "2010-09-09", "Description": "A sample template", "Resources": { "myuser": { "Type": "AWS::IAM::User", "Properties": { "Path": "/", "LoginProfile": { "Password": "myP@ssW0rd" }, "Policies": [ { "PolicyName": "giveaccesstoqueueonly", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sqs:*" ], "Resource": [ "myqueue.Arn" ] }, { "Effect": "Deny", "Action": [ "sqs:*" ], "NotResource": [ "myqueue.Arn" ] } ] } }, { "PolicyName": "giveaccesstotopiconly", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sns:*" ], "Resource": [ "mytopic" ] }, { "Effect": "Deny", "Action": [ "sns:*" ], "NotResource": [ "mytopic" ] } ] } } ] } } } } ``` ```yaml title="Negative test num. 1 - yaml file" AWSTemplateFormatVersion: "2010-09-09" Description: A sample template Resources: myuser: Type: AWS::IAM::User Properties: Path: "/" LoginProfile: Password: myP@ssW0rd123asw Policies: PolicyName: giveaccesstoqueueonly PolicyDocument: Version: '2012-10-17' Statement: Effect: Allow Action: sqs:* Resource: !GetAtt myqueue.Arn Effect: Deny Action: sqs:* NotResource: !GetAtt myqueue.Arn PolicyName: giveaccesstotopiconly PolicyDocument: Version: '2012-10-17' Statement: Effect: Allow Action: sns:* Resource: !Ref mytopic Effect: Deny Action: sns:* NotResource: !Ref mytopic ``` ```json title="Negative test num. 2 - json file" { "AWSTemplateFormatVersion": "2010-09-09", "Description": "A sample template", "Resources": { "myuser": { "Type": "AWS::IAM::User", "Properties": { "Path": "/", "LoginProfile": { "Password": "myP@ssW0rd123asw" }, "Policies": [ { "PolicyName": "giveaccesstoqueueonly", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Resource": [ "myqueue.Arn" ], "Effect": "Allow", "Action": [ "sqs:*" ] }, { "Effect": "Deny", "Action": [ "sqs:*" ], "NotResource": [ "myqueue.Arn" ] } ] } }, { "PolicyName": "giveaccesstotopiconly", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sns:*" ], "Resource": [ "mytopic" ] }, { "Action": [ "sns:*" ], "NotResource": [ "mytopic" ], "Effect": "Deny" } ] } } ] } } } } ```