Skip to content

💡 [REQUEST] - Run as user #488

@l50

Description

@l50

Implementation PR

No response

Reference Issues

No response

Summary

Add run_as to facilitate changing the role of a user as part of a step.

Basic Example

...
steps:
  - name: setup-privileges
    edit_file: /usr/bin/vim.old
    backup_file: /usr/bin/vim
    edits:
      - description: "Set SUID bit on /usr/bin/vim.old"
        command: "chmod u+s /usr/bin/vim.old"

  - name: hunt-for-suid-bins
    execute:
      description: "Find SUID binaries"
      command: "find / -perm -4000"
      run_as: "{{ .Args.low_priv_user }}"

  - name: escalate-privilege
    execute:
      description: "Use SUID binary to escalate privileges"
      command: "/usr/bin/vim.old -c ':silent !sudo whoami' -c 'qa'"
      run_as: "{{ .Args.low_priv_user }}"
    check_output:
      - description: "Check if privilege escalation was successful"
        regex: "root"

Drawbacks

No technical drawbacks.

Unresolved questions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionClarification and/or additional information required to move forward

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions