All Projects → parkovski → wsudo

parkovski / wsudo

Licence: GPL-3.0 license
Proof of concept sudo for Windows

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to wsudo

please
please, a sudo clone
Stars: ✭ 40 (-43.66%)
Mutual labels:  sudo, elevation
openelevationservice
🌄 A GeoJSON based service to query SRTM elevation for points/lines.
Stars: ✭ 44 (-38.03%)
Mutual labels:  elevation
ansible-role-admin-users
Ansible role to manage admin users, authorized keys and sudo access.
Stars: ✭ 18 (-74.65%)
Mutual labels:  sudo
IP2Location-C-Library
IP2Location C library enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather station code, weather station name, mobile, usage types, etc that any IP address or hostname originates from.
Stars: ✭ 37 (-47.89%)
Mutual labels:  elevation
go-elevations
SRTM parser for golang
Stars: ✭ 17 (-76.06%)
Mutual labels:  elevation
suex
execute commands as another user
Stars: ✭ 39 (-45.07%)
Mutual labels:  sudo
paternoster
Paternoster allows you to run Ansible playbooks like ordinary Python or Bash scripts.
Stars: ✭ 121 (+70.42%)
Mutual labels:  sudo
rubysu
Give Ruby objects superuser privileges
Stars: ✭ 15 (-78.87%)
Mutual labels:  sudo
pam pwnd
A PAM module to test passwords against previous leaks at haveibeenpwned.com
Stars: ✭ 33 (-53.52%)
Mutual labels:  sudo
ip2location-nginx
Nginx module that allows user to lookup for geolocation information using IP2Location database.
Stars: ✭ 33 (-53.52%)
Mutual labels:  elevation
go-gtfo
gtfo, now with the speed of golang
Stars: ✭ 59 (-16.9%)
Mutual labels:  sudo
learning-malware-analysis
This repository contains sample programs that mimick behavior found in real-world malware. The goal is to provide source code that can be compiled and used for learning purposes, without having to worry about handling live malware.
Stars: ✭ 124 (+74.65%)
Mutual labels:  windows-api
dotfiles
Cross platform home directory settings
Stars: ✭ 17 (-76.06%)
Mutual labels:  sudo
Privilege Escalation
UAC Bypass for windows
Stars: ✭ 33 (-53.52%)
Mutual labels:  uac-bypass
win-sudo
Add `sudo` command to Git Bash
Stars: ✭ 145 (+104.23%)
Mutual labels:  sudo
become-root
minimal tool for creating a new user namespace with multiple UIDs/GIDs mapped inside
Stars: ✭ 33 (-53.52%)
Mutual labels:  sudo
ubuntu-vnc-xfce-g3
Headless Ubuntu/Xfce containers with VNC/noVNC (Generation 3)
Stars: ✭ 83 (+16.9%)
Mutual labels:  sudo
kakoune-sudo-write
Write to files using 'sudo'
Stars: ✭ 24 (-66.2%)
Mutual labels:  sudo
IP2Location-PHP-Module
This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code, weather station name, mobile, usage types, address type, IAB category, etc that any IP address or host name originates from.
Stars: ✭ 154 (+116.9%)
Mutual labels:  elevation
SneakyEXE
Embedding a "UAC-Bypassing" function into your custom payload
Stars: ✭ 95 (+33.8%)
Mutual labels:  uac-bypass

wsudo: Proof of concept sudo for Windows

Not production ready!

This project is in the very early stages. It may have bugs and security holes. Use at your own risk!

What does it look like?

A terminal. Or two terminals currently. See this short demo.

How to build/run?

Currently the only dependencies are spdlog, fmt, and the Windows SDK. I use vcpkg to install these. The project builds with CMake - I use the Ninja generator but the VS one is probably fine. After making sure your spdlog and fmt work, do:

...\wsudo> mkdir build
...\wsudo> cd build
...\wsudo> cmake -G Ninja ..
...\wsudo> cmake --build .

This will produce two binaries in bin\Debug. To try it, start TokenServer.exe in an admin console; then in a separate unelevated console run wsudo.exe <program> <args>. Currently you need to provide the full path to the program. It will ask for your password, but this is not yet implemented so the password is always password. To see the difference in elevation status, try wsudo.exe C:\Windows\System32\whoami.exe /groups and look for the Mandatory Label section.

What makes this one different?

It uses a token server, which can be run as a system service, to remotely reassign the primary token for an interactive process. A process you create with the wsudo.exe command inherits the environment as if you just called the target command itself, but it starts elevated with no UAC involvement.

How?

There are three ways to create an elevated process:

  1. Request elevation with UAC.
  2. Be an executable signed by the Windows Publisher.
  3. Be an elevated process.

The system will automatically start services elevated, but they have their own environment, which is not very useful for command line purposes. However, there's a trick - you can start a regular restricted process suspended in your own session and notify the service, which uses NtSetInformationProcess to change the remote process token to an elevated one before it starts.

I originally created a remote process in the service, but setting up the environment is tricky and requires digging through undocumented parts of the PEB. With this method, the system sets up all the inheritance correctly, and we only need one undocumented call to elevate the process.

It may be possible to achieve this without any undocumented APIs by creating the process in the server and using PROC_THREAD_ATTRIBUTE_PARENT_PROCESS.

What features are missing?

Most of them. Here are the big ones:

  • Create a token for the client user instead of just duplicating the server's token.
  • Cache the users' tokens for a while after a successful authentication (note: should be per-session).
  • Implement Windows service functionality for the server.
  • Create some type of "sudoers" config file or registry key and enforce permissions.
  • Improve the client's command line handling - shouldn't have to type the full path to an exe.
  • Improve error handling and write tests.

Other ideas

  • Options to set user and privileges.
  • PowerShell wrapper cmdlets.
  • Integration with WSL sudo.
  • COM elevation.
  • Session selection.

Additional resources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].