Ansible

Enumerating Ansible

  • Is Ansible in use? (Server)

ansible

ls /etc/ansible

grep ansible /etc/passwd
  • Identify Ansible nodes (Client)

grep ansible /etc/passwd

Attack Vectors

  • Initiated from server

  • ad-hoc commands

  • playbooks

  • Running ansible commands

su ansibleadm

ansible victims -a "whoami" 
  • running as root the name victims comes from the /etc/ansible/hosts file so adjust as needed

Ansible Playbooks

  • Running playbooks

Exploiting Playbooks

root

  • run playbooks as the ansible user

not root

  • search for hardcoded creds in playbooks

    • ansible_become_pass

    • /var/log/syslog | grep for pass

Adding tasks if writable

  • Reverse Meterpreter

  • or

Ansible Vault

  • Copy encrypted password

  • use ansible2john.py

  • returns string for hashcat to use

  • copy string into testhash.txt

  • then run hashcat

  • copy original vault string to text file and use ansible-vault decrypt with the discovered password

Ansible Data Leakage

  • leak to /var/log/syslog

  • Cleartext in playbooks

  • unless nolog is set in the playbook

Last updated

Was this helpful?