Skip to main content

Privilege escalation

Description

Due to an insecure role configuration, it is possible to obtain administrative access or privileges using a standard user account.

Impact

Get access to information and operations that should not be available for the current role.

Recommendation

The roles must be controlled with users tokens or the exposure of user ID must be avoided.

Threat

Authenticated attacker from the Internet.

Expected Remediation Time

⌚ 60 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the vulnerability.

Base

  • Attack vector: N
  • Attack complexity: H
  • Privileges required: H
  • User interaction: N
  • Scope: C
  • Confidentiality: H
  • Integrity: H
  • Availability: H

Temporal

  • Exploit code madurity: X
  • Remediation level: X
  • Report confidence: X

Result

  • Vector string: CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H/E:X/RL:X/RC:X
  • Score:
    • Base: 8.0
    • Temporal: 8.0
  • Severity:
    • Base: High
    • Temporal: High

Code Examples

Compliant code

Every user role should have clearly defined authorization restrictions to resources

{
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": [
"arn:aws:::123456789012:role/user"
"arn:aws:::123456789012:role/admin"
]
}

Non compliant code

The application uses a resource with unrestricted access or not correctly configured restrictions

Resources:
BucketPolicy1:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: DOC-EXAMPLE-BUCKET
PolicyDocument:
Version: 2012-10-17
Statement:
- Action:
- 's3:GetObject'
Effect: Allow
Resource:
- ''
- - 'arn:aws:s3:::'
- DOC-EXAMPLE-BUCKET
- /*
Principal: '*'
Condition:
StringLike:
'aws:Referer':
- 'http://www.example.com/*'
- 'http://example.net/*'

An IAM configuration with a PassRole that uses a wild card access

Resources:
AWS_IAM_Role_1:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Action: iam:PassRole
Resource: '*'
Condition:
StringEquals:
iam:PassedToService: myhost.com

Requirements

free trial

Search for vulnerabilities in your apps for free with our automated security testing! Start your 21-day free trial and discover the benefits of our Continuous Hacking Machine Plan. If you prefer a full service that includes the expertise of our ethical hackers, don't hesitate to contact us for our Continuous Hacking Squad Plan.