Skip to main content

Insecure service configuration - Bucket

Description

The native S3 VersioningConfiguration resource, which allows to preserve, recover and restore each version of each object stored in the Buckets due to causes such as malicious actions of users or application failures, is not enabled.

Impact

  • Delete information from S3 buckets permanently.
  • Avoid recovering information that was deleted by mistake or maliciously.

Recommendation

Securely configure the Buckets by enabling the VersioningConfiguration resource.

Threat

Internet attacker with access to S3 Buckets.

Expected Remediation Time

⌚ 30 minutes.

Score

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

Base

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

Temporal

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

Result

  • Vector string: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H/E:P/RL:O/RC:X
  • Score:
    • Base: 4.9
    • Temporal: 4.4
  • Severity:
    • Base: Medium
    • Temporal: Medium

Code Examples

Compliant code

All services should have the versioning configuration correctly configured

resource "aws_s3_bucket" "state_bucket" {
bucket = "${data.aws_caller_identity.current.account_id}-terraform-state"
acl = var.acl
force_destroy = var.force_destroy

versioning {
enabled = true
}

server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
kms_master_key_id = aws_kms_key.mykey.arn
sse_algorithm = "aws:kms"
}
}
}
}

Non compliant code

There are services without the versioning configuration resource configured

resource "aws_s3_bucket" "state_bucket" {
bucket = "${data.aws_caller_identity.current.account_id}-terraform-state"
acl = var.acl
force_destroy = var.force_destroy

versioning {
enabled = false
}

server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
kms_master_key_id = aws_kms_key.mykey.arn
sse_algorithm = "aws:kms"
}
}
}
}

Using the AWS CLI, the following command check if the S3 configuration has the versioning flag enabled

$ aws s3api get-bucket-versioning
--bucket {bucket_id}

If the command does not return any CLI output, the S3 versioning feature is not enabled for the searched bucket

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.