Compare commits

..

26 Commits

Author SHA1 Message Date
Carlos Polop
0a4df51b06 Update 1_system_information.sh 2022-02-05 19:56:14 +00:00
Carlos Polop
7c275d50bc Update peass-parser.py 2022-02-04 15:43:17 +00:00
Carlos Polop
d57877077f Update peass-parser.py 2022-02-04 01:13:04 +00:00
Carlos Polop
e3238acc2b Update peass-parser.py 2022-02-04 01:12:40 +00:00
Carlos Polop
9f4045c697 Merge pull request #264 from deoxykev/master
More robust implementation of pkexec binary modification time check
2022-02-03 09:53:50 +00:00
Kevin Pham
52c2a1e11b fix typo
fix typo
2022-02-02 21:32:43 -08:00
Kevin Pham
f3495c48e9 Update 1_system_information.sh
More robust implementation of pkexec binary modification time check with integer comparison instead of date regex grep.

1642035600 == Thursday, January 13, 2022 1:00:00 AM
Which is when it was first patched. We have to check this way because the polkit version number is the same, patched & unpatched.
2022-02-02 21:30:43 -08:00
Carlos Polop
db89a779ad Update 1_system_information.sh 2022-02-01 16:21:36 +00:00
Carlos Polop
77cc22a657 Update 1_system_information.sh 2022-01-31 13:21:10 +00:00
Carlos Polop
cc1e2b4d3c Update CI-master_tests.yml 2022-01-31 13:19:53 +00:00
Carlos Polop
6ab4e6798f Update CI-master_tests.yml 2022-01-27 21:39:13 +00:00
Carlos Polop
568f8cafa9 Update CI-master_tests.yml 2022-01-27 18:26:59 +00:00
Carlos Polop
159a2d8643 Update CI-master_tests.yml 2022-01-27 15:35:57 +00:00
Carlos Polop
d02e91a451 Update CI-master_tests.yml 2022-01-26 10:19:51 +00:00
Carlos Polop
db1ad797d9 Update peass.rb 2022-01-24 10:33:57 +00:00
Carlos Polop
b9c8df71c5 Merge pull request #260 from carlospolop/linpeas_dev
Update 5_users_information.sh
2022-01-16 17:19:35 +00:00
Carlos Polop
c53425d4bc Update 5_users_information.sh 2022-01-16 12:19:27 +00:00
Carlos Polop
3723327e21 Update README.md 2022-01-16 12:04:31 +00:00
Carlos Polop
8f12ad9d67 Update winPEAS.bat 2022-01-09 21:39:55 +00:00
Carlos Polop
3faac92a01 Merge pull request #259 from melnicek/master
Typo
2022-01-09 21:36:01 +00:00
Peter Melniček
cb81dbf02f Update 3_procs_crons_timers_srvcs_sockets.sh 2022-01-09 17:55:39 +01:00
Carlos Polop
8c67152e17 Merge pull request #254 from godylockz/latest_release
Update Fetching Latest Releases
2022-01-05 23:42:44 +00:00
godylockz
9c31073279 Update to using release/latest/download 2021-12-31 12:23:33 -05:00
godylockz
f7eb8ce150 Remove trailing 2021-12-31 12:21:03 -05:00
godylockz
c8b28b1fb6 Fix CRLF 2021-12-31 12:18:31 -05:00
Carlos Polop
d15e3dffd5 Merge pull request #253 from carlospolop/linpeas_dev
color correction
2021-12-31 16:27:03 +00:00
19 changed files with 1359 additions and 1328 deletions

View File

@@ -5,6 +5,9 @@ on:
branches: branches:
- master - master
schedule:
- cron: "5 4 * * SUN"
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -362,6 +365,10 @@ jobs:
with: with:
name: linpeas_darwin_arm64 name: linpeas_darwin_arm64
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"
# Create the release # Create the release
- name: Create Release - name: Create Release
id: create_release id: create_release
@@ -369,8 +376,8 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{ github.ref }} tag_name: ${{steps.date.outputs.date}}
release_name: Release ${{ github.ref }} release_name: Release ${{ github.ref }} ${{steps.date.outputs.date}}
draft: false draft: false
prerelease: false prerelease: false

View File

@@ -17,9 +17,7 @@ Find the **latest versions of all the scripts and binaries in [the releases page
```bash ```bash
# From github # From github
LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/carlospolop/PEASS-ng/releases/latest) curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh
LATEST_VERSION=$(echo $LATEST_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
curl -L https://github.com/carlospolop/PEASS-ng/releases/download/$LATEST_VERSION/linpeas.sh | sh
``` ```
```bash ```bash
@@ -44,7 +42,7 @@ less -r /dev/shm/linpeas.txt #Read with colors
```bash ```bash
# Use a linpeas binary # Use a linpeas binary
wget https://github.com/carlospolop/PEASS-ng/releases/download/refs%2Fheads%2Fmaster/linpeas_linux_amd64 wget https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas_linux_amd64
chmod +x linpeas_linux_amd64 chmod +x linpeas_linux_amd64
./linpeas_linux_amd64 ./linpeas_linux_amd64
``` ```

View File

@@ -21,6 +21,17 @@ else echo_not_found "sudo"
fi fi
echo "" echo ""
#-- SY) CVE-2021-4034
if [ `command -v pkexec` ] && stat -c '%a' $(which pkexec) | grep -q 4755 && [ "$(stat -c '%Y' $(which pkexec))" -lt "1642035600" ]; then
echo "Vulnerable to CVE-2021-4034" | sed -${E} "s,.*,${SED_RED_YELLOW},"
fi
#-- SY) CVE-2021-3560
polkitVersion=$(systemctl status polkit.service | grep version | cut -d " " -f 9)
if [[ "$(apt list --installed 2>/dev/null | grep polkit | grep -c 0.105-26)" -ge 1 || "$(yum list installed | grep polkit | grep -c 0.117-2)" ]]; then
echo "Vulnerable to CVE-2021-3560" | sed -${E} "s,.*,${SED_RED_YELLOW},"
fi
#--SY) USBCreator #--SY) USBCreator
if (busctl list 2>/dev/null | grep -q com.ubuntu.USBCreator) || [ "$DEBUG" ]; then if (busctl list 2>/dev/null | grep -q com.ubuntu.USBCreator) || [ "$DEBUG" ]; then
print_2title "USBCreator" print_2title "USBCreator"

View File

@@ -28,7 +28,7 @@ else
echo "" echo ""
#-- PCS) Binary processes permissions #-- PCS) Binary processes permissions
print_2title "Binary processes permissions (non 'root root' and not beloging to current user)" print_2title "Binary processes permissions (non 'root root' and not belonging to current user)"
print_info "https://book.hacktricks.xyz/linux-unix/privilege-escalation#processes" print_info "https://book.hacktricks.xyz/linux-unix/privilege-escalation#processes"
binW="IniTialiZZinnggg" binW="IniTialiZZinnggg"
ps auxwww 2>/dev/null | awk '{print $11}' | while read bpath; do ps auxwww 2>/dev/null | awk '{print $11}' | while read bpath; do

View File

@@ -60,9 +60,9 @@ fi
#-- UI) Sudo -l #-- UI) Sudo -l
print_2title "Checking 'sudo -l', /etc/sudoers, and /etc/sudoers.d" print_2title "Checking 'sudo -l', /etc/sudoers, and /etc/sudoers.d"
print_info "https://book.hacktricks.xyz/linux-unix/privilege-escalation#sudo-and-suid" print_info "https://book.hacktricks.xyz/linux-unix/privilege-escalation#sudo-and-suid"
(echo '' | sudo -S -l | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoB,${SED_RED},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW}," | sed "s,\!root,${SED_RED},") 2>/dev/null || echo_not_found "sudo" (echo '' | timeout 1 sudo -S -l | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoB,${SED_RED},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW}," | sed "s,\!root,${SED_RED},") 2>/dev/null || echo_not_found "sudo"
if [ "$PASSWORD" ]; then if [ "$PASSWORD" ]; then
(echo "$PASSWORD" | sudo -S -l | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoB,${SED_RED},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW},") 2>/dev/null || echo_not_found "sudo" (echo "$PASSWORD" | timeout 1 sudo -S -l | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoB,${SED_RED},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW},") 2>/dev/null || echo_not_found "sudo"
fi fi
( grep -Iv "^$" cat /etc/sudoers | grep -v "#" | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoB,${SED_RED},g" | sed "s,pwfeedback,${SED_RED},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW},") 2>/dev/null || echo_not_found "/etc/sudoers" ( grep -Iv "^$" cat /etc/sudoers | grep -v "#" | sed "s,_proxy,${SED_RED},g" | sed "s,$sudoG,${SED_GREEN},g" | sed -${E} "s,$sudoB,${SED_RED},g" | sed "s,pwfeedback,${SED_RED},g" | sed -${E} "s,$sudoVB1,${SED_RED_YELLOW}," | sed -${E} "s,$sudoVB2,${SED_RED_YELLOW},") 2>/dev/null || echo_not_found "/etc/sudoers"
if ! [ "$IAMROOT" ] && [ -w '/etc/sudoers.d/' ]; then if ! [ "$IAMROOT" ] && [ -w '/etc/sudoers.d/' ]; then

View File

@@ -37,7 +37,7 @@ class MetasploitModule < Msf::Post
)) ))
register_options( register_options(
[ [
OptString.new('PEASS_URL', [true, 'Path to the PEASS script. Accepted: http(s):// URL or absolute local path. Linpeas: https://raw.githubusercontent.com/carlospolop/PEASS-ng/master/linPEAS/linpeas.sh', "https://raw.githubusercontent.com/carlospolop/PEASS-ng/master/winPEAS/winPEASexe/binaries/Obfuscated%20Releases/winPEASany.exe"]), OptString.new('PEASS_URL', [true, 'Path to the PEASS script. Accepted: http(s):// URL or absolute local path. Linpeas: https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh', "https://github.com/carlospolop/PEASS-ng/releases/latest/download/winPEASany_ofs.exe"]),
OptString.new('PASSWORD', [false, 'Password to encrypt and obfuscate the script (randomly generated). The length must be 32B. If no password is set, only base64 will be used.', rand(36**32).to_s(36)]), OptString.new('PASSWORD', [false, 'Password to encrypt and obfuscate the script (randomly generated). The length must be 32B. If no password is set, only base64 will be used.', rand(36**32).to_s(36)]),
OptString.new('TEMP_DIR', [false, 'Path to upload the obfuscated PEASS script inside the compromised machine. By default "C:\Windows\System32\spool\drivers\color" is used in Windows and "/tmp" in Unix.', '']), OptString.new('TEMP_DIR', [false, 'Path to upload the obfuscated PEASS script inside the compromised machine. By default "C:\Windows\System32\spool\drivers\color" is used in Windows and "/tmp" in Unix.', '']),
OptString.new('PARAMETERS', [false, 'Parameters to pass to the script', nil]), OptString.new('PARAMETERS', [false, 'Parameters to pass to the script', nil]),

View File

@@ -5,7 +5,7 @@ import re
import json import json
# Pattern to identify main section titles # Pattern to identify main section titles
TITLE1_PATTERN = r"════════════════════════════════════" TITLE1_PATTERN = r"══════════════╣" # The size of the first pattern varies, but at least should be that large
TITLE2_PATTERN = r"╔══════════╣" TITLE2_PATTERN = r"╔══════════╣"
TITLE3_PATTERN = r"══╣" TITLE3_PATTERN = r"══╣"
INFO_PATTERN = r"" INFO_PATTERN = r""
@@ -14,15 +14,15 @@ TITLE_CHARS = ['═', '╔', '╣', '╚']
# Patterns for colors # Patterns for colors
## The order is important, the first string colored with a color will be the one selected (the same string cannot be colored with different colors) ## The order is important, the first string colored with a color will be the one selected (the same string cannot be colored with different colors)
COLORS = { COLORS = {
"REDYELLOW": [r"\x1b\[1;31;103m"], "REDYELLOW": ['\x1b[1;31;103m'],
"RED": [r"\x1b\[1;31m"], "RED": ['\x1b[1;31m'],
"GREEN": [r"\x1b\[1;32m"], "GREEN": ['\x1b[1;32m'],
"YELLOW": [r"\x1b\[1;33m"], "YELLOW": ['\x1b[1;33m'],
"BLUE": [r"\x1b\[1;34m"], "BLUE": ['\x1b[1;34m'],
"MAGENTA": [r"\x1b\[1;95m", r"\x1b\[1;35m"], "MAGENTA": ['\x1b[1;95m', '\x1b[1;35m'],
"CYAN": [r"\x1b\[1;36m", r"\x1b\[1;96m"], "CYAN": ['\x1b[1;36m', '\x1b[1;96m'],
"LIGHT_GREY": [r"\x1b\[1;37m"], "LIGHT_GREY": ['\x1b[1;37m'],
"DARKGREY": [r"\x1b\[1;90m"], "DARKGREY": ['\x1b[1;90m'],
} }
@@ -52,11 +52,23 @@ def get_colors(line: str) -> dict:
for c,regexs in COLORS.items(): for c,regexs in COLORS.items():
colors[c] = [] colors[c] = []
for reg in regexs: for reg in regexs:
for re_found in re.findall(reg+"(.+?)\x1b|$", line): split_color = line.split(reg)
re_found = clean_colors(re_found.strip())
#Avoid having the same color for the same string # Start from the index 1 as the index 0 isn't colored
if re_found and not any(re_found in values for values in colors.values()): if split_color and len(split_color) > 1:
colors[c].append(re_found) split_color = split_color[1:]
# For each potential color, find the string before any possible color terminatio
for potential_color_str in split_color:
color_str1 = potential_color_str.split('\x1b')[0]
color_str2 = potential_color_str.split("\[0")[0]
color_str = color_str1 if len(color_str1) < len(color_str2) else color_str2
if color_str:
color_str = clean_colors(color_str.strip())
#Avoid having the same color for the same string
if color_str and not any(color_str in values for values in colors.values()):
colors[c].append(color_str)
if not colors[c]: if not colors[c]:
del colors[c] del colors[c]
@@ -75,10 +87,10 @@ def clean_title(line: str) -> str:
def clean_colors(line: str) -> str: def clean_colors(line: str) -> str:
"""Given a line clean the colors inside of it""" """Given a line clean the colors inside of it"""
for reg in re.findall(r'\x1b[^ ]+\dm', line): for reg in re.findall(r'\x1b\[[^a-zA-Z]+\dm', line):
line = line.replace(reg,"") line = line.replace(reg,"")
line = line.replace('\x1b',"") #Sometimes that byte stays line = line.replace('\x1b',"").replace("[0m", "") #Sometimes that byte stays
line = line.strip() line = line.strip()
return line return line
@@ -94,6 +106,9 @@ def parse_line(line: str):
global FINAL_JSON, C_SECTION, C_MAIN_SECTION, C_2_SECTION, C_3_SECTION global FINAL_JSON, C_SECTION, C_MAIN_SECTION, C_2_SECTION, C_3_SECTION
if "Cron jobs" in line:
a=1
if is_section(line, TITLE1_PATTERN): if is_section(line, TITLE1_PATTERN):
title = parse_title(line) title = parse_title(line)
FINAL_JSON[title] = { "sections": {}, "lines": [], "infos": [] } FINAL_JSON[title] = { "sections": {}, "lines": [], "infos": [] }
@@ -124,8 +139,8 @@ def parse_line(line: str):
C_SECTION["lines"].append({ C_SECTION["lines"].append({
"raw_text": line, "raw_text": line,
"clean_text": clean_colors(line), "colors": get_colors(line),
"colors": get_colors(line) "clean_text": clean_title(clean_colors(line))
}) })

View File

@@ -237,7 +237,7 @@ CALL :T_Progress 2
:RemodeDeskCredMgr :RemodeDeskCredMgr
CALL :ColorLine " %E%33m[+]%E%97m Remote Desktop Credentials Manager" CALL :ColorLine " %E%33m[+]%E%97m Remote Desktop Credentials Manager"
ECHO. [?] https://book.hacktricks.xyz/windows/windows-local-privilege-escalation#remote-desktop-credential-manager ECHO. [?] https://book.hacktricks.xyz/windows/windows-local-privilege-escalation#remote-desktop-credential-manager
IF exist "%AppLocal%\Local\Microsoft\Remote Desktop Connection Manager\RDCMan.settings" ECHO.Found: RDCMan.settings in %AppLocal%\Local\Microsoft\Remote Desktop Connection Manager\RDCMan.settings, check for credentials in .rdg files IF exist "%LOCALAPPDATA%\Local\Microsoft\Remote Desktop Connection Manager\RDCMan.settings" ECHO.Found: RDCMan.settings in %AppLocal%\Local\Microsoft\Remote Desktop Connection Manager\RDCMan.settings, check for credentials in .rdg files
ECHO. ECHO.
CALL :T_Progress 1 CALL :T_Progress 1

View File

@@ -17,10 +17,7 @@ Precompiled binaries:
```bash ```bash
# Get latest release # Get latest release
$latestRelease = Invoke-WebRequest https://github.com/carlospolop/PEASS-ng/releases/latest -Headers @{"Accept"="application/json"} $url = "https://github.com/carlospolop/PEASS-ng/releases/latest/download/winPEASany_ofs.exe"
$json = $latestRelease.Content | ConvertFrom-Json
$latestVersion = $json.tag_name
$url = "https://github.com/carlospolop/PEASS-ng/releases/download/$latestVersion/winPEASany_ofs.exe"
# One liner to download and execute winPEASany from memory in a PS shell # One liner to download and execute winPEASany from memory in a PS shell
$wp=[System.Reflection.Assembly]::Load([byte[]](Invoke-WebRequest "$url" -UseBasicParsing | Select-Object -ExpandProperty Content)); [winPEAS.Program]::Main("") $wp=[System.Reflection.Assembly]::Load([byte[]](Invoke-WebRequest "$url" -UseBasicParsing | Select-Object -ExpandProperty Content)); [winPEAS.Program]::Main("")
@@ -108,9 +105,13 @@ REG ADD HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1
Below you have some indications about what does each color means exacty, but keep in mind that **Red** is for something interesting (from a pentester perspective) and **Green** is something well configured (from a defender perspective). Below you have some indications about what does each color means exacty, but keep in mind that **Red** is for something interesting (from a pentester perspective) and **Green** is something well configured (from a defender perspective).
![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/colors.png)
## Instructions to compile you own obfuscated version ## Instructions to compile you own obfuscated version
<details>
<summary>Details</summary>
In order to compile an **ofuscated version** of Winpeas and bypass some AVs you need to ** install dotfuscator ** in *VisualStudio*. In order to compile an **ofuscated version** of Winpeas and bypass some AVs you need to ** install dotfuscator ** in *VisualStudio*.
To install it *open VisualStudio --> Go to Search (CTRL+Q) --> Write "dotfuscator"* and just follow the instructions to install it. To install it *open VisualStudio --> Go to Search (CTRL+Q) --> Write "dotfuscator"* and just follow the instructions to install it.
@@ -128,10 +129,9 @@ Once you have installed and activated it you need to:
![](https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/winPEAS/winPEASexe/images/dotfuscator.PNG) ![](https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/winPEAS/winPEASexe/images/dotfuscator.PNG)
**IMPORTANT**: Note that Defender will higly probable delete the winpeas iintial unobfuscated version, so you need to set as expections the origin folder of Winpeas and the folder were the obfuscated version will be saved:
## Colors ![](https://user-images.githubusercontent.com/1741662/148418852-e7ffee6a-c270-4e26-bf38-bb8977b3ad9c.png)
</details>
![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/colors.png)
## Checks ## Checks