• Stars
    star
    987
  • Rank 46,382 (Top 1.0 %)
  • Language
    PowerShell
  • Created over 3 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pure PowerShell implementation of CVE-2021-1675 Print Spooler Local Privilege Escalation (PrintNightmare)

CVE-2021-1675 - PrintNightmare LPE (PowerShell)

Caleb Stewart | John Hammond | July 1, 2021


CVE-2021-1675 is a critical remote code execution and local privilege escalation vulnerability dubbed "PrintNightmare."

Proof-of-concept exploits have been released (Python, C++) for the remote code execution capability, and a C# rendition for local privilege escalation. We had not seen a native implementation in pure PowerShell, and we wanted to try our hand at refining and recrafting the exploit.

This PowerShell script performs local privilege escalation (LPE) with the PrintNightmare attack technique.

image

This has been tested on Windows Server 2016 and Windows Server 2019.

Usage

Add a new user to the local administrators group by default:

Import-Module .\cve-2021-1675.ps1
Invoke-Nightmare # add user `adm1n`/`P@ssw0rd` in the local admin group by default

Invoke-Nightmare -DriverName "Xerox" -NewUser "john" -NewPassword "SuperSecure" 

Supply a custom DLL payload, to do anything else you might like.

Import-Module .\cve-2021-1675.ps1
Invoke-Nightmare -DLL "C:\absolute\path\to\your\bindshell.dll"

Details

  • The LPE technique does not need to work with remote RPC or SMB, as it is only working with the functions of Print Spooler.
  • This script embeds a Base64-encoded GZIPped payload for a custom DLL, that is patched according to your arguments, to easily add a new user to the local administrators group.
  • This script embeds methods from PowerSploit/PowerUp to reflectively access the Win32 APIs.
  • This method does not loop through all printer drivers to find the appropriate DLL path -- it simply grabs the first driver and determines the appropriate path.

More Repositories

1

pwncat

Fancy reverse and bind shell handler
Python
2,551
star
2

bypass-clm

PowerShell Constrained Language Mode Bypass
C#
215
star
3

python-htb

A Python API for Hack the Box platform interaction
Python
63
star
4

pam_sneaky

A silly PAM module to allow authentication as any user with a single password.
C
55
star
5

peach

Simple vulnerability scanning framework
Python
49
star
6

python-sigma

Python API for interacting with sigma rules.
Python
48
star
7

RegistryBaseline

Baseline/Test for persistence in common Windows Registry locations
PowerShell
23
star
8

calebstew.art

Landing page for calebstew.art
TeX
22
star
9

init-machine

Initial scanning and enumeration tool for basic penetration testing challenges such as Hack the Box
Shell
19
star
10

pwncat-windows-c2

pwncat windows c2 components
C#
17
star
11

offsec-exam

Template project for Offensive Security Exam Documentation
TeX
10
star
12

vroomm

Simple Virtual Machine Manager in Golang
Go
7
star
13

catato

https://catato.lol
HTML
7
star
14

swaycwd

Sway version of xcwd able to return the current working directory of the focused sway node
Shell
6
star
15

gmusicclient

Google Play Music command line client written in python
Python
6
star
16

subencode

Automatic subencoding of data for use in restrictive binary exploits
Python
5
star
17

md5

MD5 Hashing Algorithm for Embedded Platforms
C++
4
star
18

pwncat-testing-images

Docker images for automated pwncat testing.
Dockerfile
4
star
19

Net-Scan

Powershell ping and TCP port scan implementation
PowerShell
4
star
20

stewieos

32-bit x86 Hobby Kernel
C
4
star
21

vmm

Simple libvirt Virtual Machine Manager
Python
3
star
22

terraform-provider-alembic

Terraform provider which allows automatically executing Alembic migration scripts
Go
3
star
23

signal-cli

A fork of signal-cli with better JSON output and more useful DBUS messages
Java
2
star
24

Get-MatchingFileTypes

Look for files which match any of the given list of file signatures under a directory
PowerShell
1
star
25

dotfiles

Configuration files and scripts
Shell
1
star
26

rofi-libvirt-mode

A simple rofi custom script mode for interacting with libvirt domains
Shell
1
star
27

Remove-Grr

Remove the Grr client from a list of target clients
PowerShell
1
star
28

rice

Fedora Desktop and Laptop Rice Scripts
Python
1
star
29

Extract-AlternateDataStream

Extract alternate data streams from an individual or directory of files.
PowerShell
1
star
30

nix

NixOS System and Home Manager Flake(s)
Nix
1
star