Skip to content

Instantly share code, notes, and snippets.

@misusage
misusage / setuid-root-backdoor.md
Created November 1, 2016 02:49 — forked from dergachev/setuid-root-backdoor.md
How to use setuid to install a root backdoor.

Why You Can't Un-Root a Compromised Machine

Let's say somebody temporarily got root access to your system, whether because you "temporarily" gave them sudo rights, they guessed your password, or any other way. Even if you can disable their original method of accessing root, there's an infinite number of dirty tricks they can use to easily get it back in the future.

While the obvious tricks are easy to spot, like adding an entry to /root/.ssh/authorized_keys, or creating a new user, potentially via running malware, or via a cron job. I recently came across a rather subtle one that doesn't require changing any code, but instead exploits a standard feature of Linux user permissions system called setuid to subtly allow them to execute a root shell from any user account from the system (including www-data, which you might not even know if compromised).

If the "setuid bit" (or flag, or permission mode) is set for executable, the operating system will run not as the cur

@misusage
misusage / google_civic_api.md
Created March 10, 2017 08:14
Setup Google Civic API

How to Setup Google Civic API

This is quick guide on how to setup an API key with google and use it to communicate and retrieve data from the Civic Information API

Google Civic Information API

The Google Civic Information API lets developers build applications that display civic information to their users. For any U.S. residential address, you can look up who represents that address at each elected level of government. During supported elections, you can also look up polling places, early vote location, candidate data, and other election official information.

Installation

Setup the API Key

@misusage
misusage / nmap-tcp-full.sh
Created July 27, 2018 05:17 — forked from coffeegist/nmap-tcp-full.sh
OSCP nmap scripts
if [ "$#" -ne 3 ]; then
echo "Usage: nmap-tcp-full.sh <TCP-QUICK-RESULTS.XML> <TARGET> <OUTPUT-FILENAME>"
exit 1
fi
nmap -nvv -Pn -sSV -T1 -p$(cat $1 | grep portid | grep protocol=\"tcp\" | cut -d'"' -f4 | paste -sd "," -) --version-intensity 9 -A -oA $3 $2