aws-ca-modify-config-update-upstream

UpdateRepository can add a malicious upstream repository to a victim repository's upstream chain, enabling packages from the attacker's repository to be resolved by the victim's consumers.

derived aws emits CanModifyConfiguration

match

A conjunctive graph pattern. Variables (?x) bind node ids; every clause must hold.

{'principal': None} HasPermission {'repository': None}

where

node_type(?repository) == ArtifactRepository provider_type(?repository) == AWS::CodeArtifact::Repository effective permission includes codeartifact:UpdateRepository on ?repository

emit

source typeIdentity
target typeArtifactRepository
source?principal
target?repository
permissionscodeartifact:UpdateRepository
conditionsiam_permission
state logicPOTENTIAL by default — the attacker must also have a repository to add as an upstream (or add an existing one they can publish to) AND the consumers must request packages from that upstream. ACTIVE when the attacker also controls (CanModifyCode over) a repository they can insert as upstream AND the victim's consumers are confirmed to resolve packages through the upstream chain. BLOCKED when an SCP or permission boundary denies codeartifact:UpdateRepository.

Narrative

{principal.name} can update {repository.name}'s configuration (codeartifact:UpdateRepository), including adding a new upstream repository. If the attacker adds a repository they control as an upstream, packages published there will be resolved by {repository.name}'s consumers when not found locally, enabling upstream poisoning.

Raw rule rules/derived/aws/codeartifact.yaml

id: aws-ca-modify-config-update-upstream
emits: CanModifyConfiguration
description: UpdateRepository can add a malicious upstream repository to a victim repository's upstream
  chain, enabling packages from the attacker's repository to be resolved by the victim's consumers.
match:
- - principal: null
  - HasPermission
  - repository: null
where:
- node_type(?repository) == ArtifactRepository
- provider_type(?repository) == AWS::CodeArtifact::Repository
- effective permission includes codeartifact:UpdateRepository on ?repository
emit:
  source_type: Identity
  target_type: ArtifactRepository
  source: ?principal
  target: ?repository
  permissions:
  - codeartifact:UpdateRepository
  conditions:
  - iam_permission
  state_logic: "POTENTIAL by default \u2014 the attacker must also have a repository to add as an upstream\
    \ (or add an existing one they can publish to) AND the consumers must request packages from that upstream.\
    \  ACTIVE when the attacker also controls (CanModifyCode over) a repository they can insert as upstream\
    \ AND the victim's consumers are confirmed to resolve packages through the upstream chain.  BLOCKED\
    \ when an SCP or permission boundary denies codeartifact:UpdateRepository."
  confidence: 0.7
  derived_from:
  - effective codeartifact:UpdateRepository on ?repository (permission evaluator)
  false_positive_note: UpdateRepository also covers non-harmful configuration changes (description, tags).
    The relevant attack vector requires the attacker to (a) have UpdateRepository on the victim repo AND
    (b) have or create a repository they control with packages whose names the victim's consumers request.  Do
    not emit ACTIVE unless both conditions are confirmed; POTENTIAL is the correct default.  The code-injection
    consequence arrives via aws-ca-upstream-propagation once the malicious upstream is established (that
    rule will emit CanModifyCode from the publisher to the downstream repo's consumers).
  narrative: '{principal.name} can update {repository.name}''s configuration (codeartifact:UpdateRepository),
    including adding a new upstream repository. If the attacker adds a repository they control as an upstream,
    packages published there will be resolved by {repository.name}''s consumers when not found locally,
    enabling upstream poisoning.'
move · open · esc close