Advertisement
Sweetening

IEJScript Sploit

Feb 6th, 2024
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. # Define the path to jscript.dll for both 32-bit and 64-bit versions
  2. $syswow64Jscript = Join-Path -Path $env:windir -ChildPath "SysWOW64\jscript.dll"
  3. $system32Jscript = Join-Path -Path $env:windir -ChildPath "System32\jscript.dll"
  4.  
  5. # Function to take ownership and deny permissions
  6. function Set-FileSecurity {
  7. param (
  8. [string]$filePath
  9. )
  10.  
  11. # Take ownership
  12. $newOwner = [System.Security.Principal.NTAccount]"Administrators"
  13. $acl = Get-Acl -Path $filePath
  14. $acl.SetOwner($newOwner)
  15. Set-Acl -Path $filePath -AclObject $acl
  16.  
  17. # Deny permissions to everyone
  18. $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone", "FullControl", "None", "None", "Deny")
  19. $acl.SetAccessRule($accessRule)
  20. Set-Acl -Path $filePath -AclObject $acl
  21. }
  22.  
  23. # Apply to 64-bit Internet Explorer files
  24. if (Test-Path -Path $syswow64Jscript) {
  25. Set-FileSecurity -filePath $syswow64Jscript
  26. }
  27.  
  28. if (Test-Path -Path $system32Jscript) {
  29. Set-FileSecurity -filePath $system32Jscript
  30. }
  31.  
  32. # Apply to 32-bit Internet Explorer file (This will be the same as one of the above, depending on the system architecture)
  33. Set-FileSecurity -filePath $system32Jscript
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement