Created
April 9, 2009 21:21
-
-
Save ice799/92746 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def write_file | |
begin | |
File.open("/test", "w+") do |f| | |
f.write("hello!\n") | |
f.close | |
end | |
puts "wrote test file" | |
rescue Errno::EACCES | |
puts "could not write test file" | |
end | |
end | |
puts "ok, set uid to nobody" | |
Process.euid = 65534 | |
puts "going to try to write to / now..." | |
write_file | |
puts "restoring back to root" | |
Process.euid = 0 | |
puts "now writing file" | |
write_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment