-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ansible: post gather module, payload deployer, and file reader #18627
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a strong passion that any time code appears 3 times, it should go to a library; there are a couple of methods here that get called that magic number of times. It might be helpful to offload those to a library to make maintenance easier.
documentation/modules/exploit/linux/local/ansible_node_deployer.md
Outdated
Show resolved
Hide resolved
stime = Time.now.to_f | ||
timeout = datastore['ListenerTimeout'].to_i | ||
loop do | ||
break if timeout > 0 && (stime + timeout < Time.now.to_f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still curious about this loop condition...... why timeout > 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussion here: #18626 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a value of 0
means wait forever, I think this should be added to the documentation and the option description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like that idea.
modules/post/linux/gather/ansible_playbook_error_message_file_reader.rb
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @h00die for these great modules! I left a few comments for you to review when you get a chance.
modules/post/linux/gather/ansible_playbook_error_message_file_reader.rb
Outdated
Show resolved
Hide resolved
Took care of some of these, will look at the rest later. I'm also retroactively applying these to the |
Thanks for updating this @h00die! This looks good to me now. I just found a small incomplete fix that I will ninja patch when landing this: I tested using the docker installation you described in the documentation and verified the three modules work as expected. I'll go ahead and land it. Thanks again for your contribution! linux/local/ansible_node_deployer
linux/gather/ansible
linux/gather/ansible_playbook_error_message_file_reader
|
Release NotesThis adds 3 post exploitation modules for Ansible. The first one gathers information and configuration. The second exploits an arbitrary file read that enables an attacker to read the first line of a file (tipicaly |
This PR adds 3 modules for ansible:
sudo
permissions, can read the first line of a file (like/etc/shadow
)This is part 2 of my new Raining Shells series
Verification
See individual markdowns for instructions