Compare commits

...

55 Commits

Author SHA1 Message Date
Carlos Polop
c2a22ad0ac Merge b3eefad3fe into cf947f01c7 2022-03-14 20:31:36 +00:00
carlospolop
b3eefad3fe check /opt 2022-03-14 16:30:44 -04:00
carlospolop
cf947f01c7 CVE-2022-0847 2022-03-10 05:34:15 -05:00
Carlos Polop
25a5b1ad63 Merge pull request #279 from lu-ka/master
Added check for CVE-2022-0847
2022-03-08 09:37:14 +00:00
lu|ka
ee80f8d97a Added check for CVE-2022-0847
See https://dirtypipe.cm4all.com/
2022-03-08 10:32:25 +01:00
Carlos Polop
7f3e4c440d Update 1_system_information.sh 2022-03-07 23:33:54 +00:00
Carlos Polop
1209890aa9 Update 6_software_information.sh 2022-03-07 23:19:23 +00:00
Carlos Polop
820e12f1ed Merge pull request #278 from carlospolop/linpeas_dev
Merge pull request #277 from julienbordet/linpeas_dev
2022-03-07 23:18:03 +00:00
Carlos Polop
f4e8443544 Merge pull request #277 from julienbordet/linpeas_dev
Single quotes in this line prevent '*' from being expanded
2022-03-07 23:14:52 +00:00
Julien Bordet
073114db86 SIngle quotes in this line prevent '*' from being expanded
Right now this section for sudoers.d does not work
2022-03-08 00:11:27 +01:00
Carlos Polop
75e11f7bb1 Update sensitive_files.yaml 2022-03-07 23:06:10 +00:00
carlospolop
09312c6883 winpeas fix 2022-03-07 22:49:35 +00:00
Carlos Polop
b6bf6a702a Update 1_system_information.sh 2022-03-07 11:23:37 +00:00
Carlos Polop
fb57aaa3d5 Merge pull request #274 from janroring/fix-lse-typo
Fixed typo that caused linux-exploit-suggester results not being displayed
2022-03-03 14:41:31 +00:00
Jan Roring
dd122b2f10 Fixed typo that caused linux-exploit-suggester results not being displayed 2022-03-02 17:47:14 +01:00
Carlos Polop
a89f235c43 Update linpeas_base.sh 2022-02-13 17:00:40 +00:00
Carlos Polop
7f0bbdbaae Update sensitive_files.yaml 2022-02-13 16:58:44 +00:00
Carlos Polop
4206e78080 Merge pull request #270 from secnigma/master
Improved CVE-2021-3560 Check
2022-02-11 19:22:44 +00:00
secnigma
dc7c9db7dd Improved CVE-2021-3560 Check
* Swapped `yum ` for `rpm ` for improved compatibility 
* Added known vulnerable version of Polkit
2022-02-11 13:23:50 -05:00
Carlos Polop
48ff8b061b Update 1_system_information.sh 2022-02-09 12:02:26 +00:00
Carlos Polop
ea09bd5f3a Update peas2json.py 2022-02-08 01:40:50 +00:00
Carlos Polop
68f1cf35b5 Merge pull request #267 from carlospolop/linpeas_dev
html and pdf
2022-02-07 13:52:33 +00:00
carlospolop
33f4ca923c html and pdf 2022-02-07 08:50:24 -05:00
Carlos Polop
b3c12e22b6 Merge pull request #266 from deathbyknowledge/add-json2pdf-script
Add json2pdf.py script
2022-02-07 13:41:58 +00:00
Steve James
ff39a57b49 add text coloring 2022-02-07 13:17:55 +00:00
Steve James
6ce34b2d61 add json2pdf.py script 2022-02-07 00:15:31 +00:00
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
Carlos Polop
21d3b3f349 Update README.md 2021-12-30 10:23:11 +00:00
Carlos Polop
aa94d9d432 Merge pull request #252 from carlospolop/linpeas_dev
trigger action
2021-12-30 09:32:35 +00:00
Carlos Polop
5b8f3968e8 Update CI-master_tests.yml 2021-12-30 01:02:53 +00:00
31 changed files with 2268 additions and 1470 deletions

View File

@@ -4,6 +4,9 @@ on:
pull_request: pull_request:
branches: branches:
- master - master
schedule:
- cron: "5 4 * * SUN"
workflow_dispatch: workflow_dispatch:
@@ -196,7 +199,7 @@ jobs:
# Run linpeas as a test # Run linpeas as a test
- name: Run linpeas - name: Run linpeas
run: linPEAS/linpeas.sh -a -d run: linPEAS/linpeas.sh -a -D
# Upload files for release # Upload files for release
- name: Upload linpeas.sh - name: Upload linpeas.sh
@@ -283,7 +286,7 @@ jobs:
# Run macpeas parts to test it # Run macpeas parts to test it
- name: Run macpeas - name: Run macpeas
run: linPEAS/linpeas.sh -d -o system_information,container,procs_crons_timers_srvcs_sockets,network_information,users_information,software_information run: linPEAS/linpeas.sh -D -o system_information,container,procs_crons_timers_srvcs_sockets,network_information,users_information,software_information
Publish_release: Publish_release:
@@ -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

@@ -1,38 +1,41 @@
# PEASS-ng - Privilege Escalation Awesome Scripts SUITE new generation # PEASS-ng - Privilege Escalation Awesome Scripts SUITE new generation
![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/linPEAS/images/peass.png) ![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/linPEAS/images/peass.png)
![](https://img.shields.io/badge/Black-Arch-black) ![](https://img.shields.io/badge/Arch-AUR-brightgreen) ![](https://img.shields.io/badge/Black%20Hat%20Arsenal-Asia%202020-red) ![](https://img.shields.io/badge/Black-Arch-black) ![](https://img.shields.io/badge/Arch-AUR-brightgreen) ![](https://img.shields.io/badge/Black%20Hat%20Arsenal-Asia%202020-red)
# Basic Tutorial # Basic Tutorial
[![Tutorial](https://img.youtube.com/vi/2Ey1WQXNp3w/0.jpg)](https://www.youtube.com/watch?v=9_fJv_weLU0&list=PL9fPq3eQfaaDxjpXaDYApfVA_IB8T14w7) [![Tutorial](https://img.youtube.com/vi/2Ey1WQXNp3w/0.jpg)](https://www.youtube.com/watch?v=9_fJv_weLU0&list=PL9fPq3eQfaaDxjpXaDYApfVA_IB8T14w7)
Here you will find **privilege escalation tools for Windows and Linux/Unix\* and MacOS**. Here you will find **privilege escalation tools for Windows and Linux/Unix\* and MacOS**.
These tools search for possible **local privilege escalation paths** that you could exploit and print them to you **with nice colors** so you can recognize the misconfigurations easily. These tools search for possible **local privilege escalation paths** that you could exploit and print them to you **with nice colors** so you can recognize the misconfigurations easily.
- Check the **Local Windows Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/checklist-windows-privilege-escalation)** - Check the **Local Windows Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/checklist-windows-privilege-escalation)**
- **[WinPEAS](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) - Windows local Privilege Escalation Awesome Script (C#.exe and .bat)** - **[WinPEAS](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) - Windows local Privilege Escalation Awesome Script (C#.exe and .bat)**
- Check the **Local Linux Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/linux-unix/linux-privilege-escalation-checklist)** - Check the **Local Linux Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/linux-unix/linux-privilege-escalation-checklist)**
- **[LinPEAS](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS) - Linux local Privilege Escalation Awesome Script (.sh)** - **[LinPEAS](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS) - Linux local Privilege Escalation Awesome Script (.sh)**
## Quick Start ## Quick Start
Find the **latest versions of all the scripts and binaries in [the releases page](https://github.com/carlospolop/PEASS-ng/releases/latest)**. Find the **latest versions of all the scripts and binaries in [the releases page](https://github.com/carlospolop/PEASS-ng/releases/latest)**.
## Let's improve PEASS together ## JSON, HTML & PDF output
Check the **[parsers](./parsers/)** directory to **transform PEASS outputs to JSON, HTML and PDF**
If you want to **add something** and have **any cool idea** related to this project, please let me know it in the **telegram group https://t.me/peass** or contribute reading the **[CONTRIBUTING.md](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/blob/master/CONTRIBUTING.md)** file.
## Let's improve PEASS together
## PEASS Style
If you want to **add something** and have **any cool idea** related to this project, please let me know it in the **telegram group https://t.me/peass** or contribute reading the **[CONTRIBUTING.md](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/blob/master/CONTRIBUTING.md)** file.
Are you a PEASS fan? Get now our merch at **[PEASS Shop](https://teespring.com/stores/peass)** and show your love for our favorite peas
## PEASS Style
## Advisory
Are you a PEASS fan? Get now our merch at **[PEASS Shop](https://teespring.com/stores/peass)** and show your love for our favorite peas
All the scripts/binaries of the PEAS suite should be used for authorized penetration testing and/or educational purposes only. Any misuse of this software will not be the responsibility of the author or of any other collaborator. Use it at your own machines and/or with the owner's permission.
## Advisory
All the scripts/binaries of the PEAS suite should be used for authorized penetration testing and/or educational purposes only. Any misuse of this software will not be the responsibility of the author or of any other collaborator. Use it at your own machines and/or with the owner's permission.
By Polop<sup>(TM)</sup>
By Polop<sup>(TM)</sup>

View File

@@ -92,7 +92,9 @@ cap_setgid_markup: "peass{CAP_SETGID_HERE}"
les_markup: "peass{LES}" les_markup: "peass{LES}"
les2_markup: "peass{LES2}" les2_markup: "peass{LES2}"
fat_linpeas_amicontained_markup: "peass{AMICONTAINED}"
fat_linpeas_gitleaks_linux_markup: "peass{GITLEAKS_LINUX}"
fat_linpeas_gitleaks_macos_markup: "peass{GITLEAKS_MACOS}"
############################## ##############################
## AUTO GENERATED VARIABLES ## ## AUTO GENERATED VARIABLES ##
@@ -118,7 +120,7 @@ defaults:
check_extra_path: "" #Check if the found files are in a specific path (only linpeas) check_extra_path: "" #Check if the found files are in a specific path (only linpeas)
good_regex: "" #The regex to color green good_regex: "" #The regex to color green
just_list_file: False #Just mention the path to the file, do not cat it just_list_file: False #Just mention the path to the file, do not cat it
line_grep: "" #The regex to grep lines in a file. IMPORTANT: This is the argument for "grep" command so you need to specify the single and double quotes (see examples) line_grep: "" #The regex to grep lines in a file. IMPORTANT: This is the argument for "grep" command so you need to specify the single and double quotes (see examples). Use double quotes to indicate the interesting things to grep as winpeas greps the things inside th double qoutes.
only_bad_lines: False #Only print lines containing something red (cnotaining bad_regex) only_bad_lines: False #Only print lines containing something red (cnotaining bad_regex)
remove_empty_lines: False #Remove empty lines, use only for text files (-I param in grep) remove_empty_lines: False #Remove empty lines, use only for text files (-I param in grep)
remove_path: "" #Not interested in files containing this path (only linpeas) remove_path: "" #Not interested in files containing this path (only linpeas)
@@ -316,6 +318,24 @@ search:
remove_path: "mysql/mysql" remove_path: "mysql/mysql"
search_in: search_in:
- common - common
- name: "passwd.ibd"
value:
type: f
search_in:
- common
- name: "password*.ibd"
value:
type: f
search_in:
- common
- name: "pwd.ibd"
value:
type: f
search_in:
- common
- name: MariaDB - name: MariaDB
value: value:
@@ -383,15 +403,17 @@ search:
search_in: search_in:
- common - common
- name: Apache - name: Apache-Nginx
value: value:
config: config:
auto_check: True auto_check: True
exec: exec:
- 'echo "Version: $(warn_exec apache2 -v 2>/dev/null; warn_exec httpd -v 2>/dev/null)"' - 'echo "Apache version: $(warn_exec apache2 -v 2>/dev/null; warn_exec httpd -v 2>/dev/null)"'
- 'echo "Nginx version: $(warn_exec nginx -v 2>/dev/null)"'
- if [ -d "/etc/apache2" ] && [ -r "/etc/apache2" ]; then 'grep -R -B1 "httpd-php" /etc/apache2 2>/dev/null'; fi
- if [ -d "/usr/share/nginx/modules" ] && [ -r "/usr/share/nginx/modules" ]; then print_3title 'Nginx modules'; ls /usr/share/nginx/modules | sed -${E} "s,$NGINX_KNOWN_MODULES,${SED_GREEN},g"; fi
- "print_3title 'PHP exec extensions'" - "print_3title 'PHP exec extensions'"
- 'grep -R -B1 "httpd-php" /etc/apache2 2>/dev/null'
files: files:
- name: "sites-enabled" - name: "sites-enabled"
value: value:
@@ -399,8 +421,7 @@ search:
files: files:
- name: "*" - name: "*"
value: value:
bad_regex: "AuthType|AuthName|AuthUserFile|ServerName|ServerAlias" bad_regex: "AuthType|AuthName|AuthUserFile|ServerName|ServerAlias|command on"
only_bad_lines: True
remove_empty_lines: True remove_empty_lines: True
remove_regex: '#' remove_regex: '#'
search_in: search_in:
@@ -409,6 +430,7 @@ search:
- name: "000-default.conf" - name: "000-default.conf"
value: value:
bad_regex: "AuthType|AuthName|AuthUserFile|ServerName|ServerAlias" bad_regex: "AuthType|AuthName|AuthUserFile|ServerName|ServerAlias"
remove_regex: '#'
type: f type: f
search_in: search_in:
- common - common
@@ -417,7 +439,7 @@ search:
value: value:
bad_regex: "On" bad_regex: "On"
remove_regex: "^;" remove_regex: "^;"
line_grep: "allow_" line_grep: '"allow_"'
type: f type: f
search_in: search_in:
- common - common
@@ -541,6 +563,7 @@ search:
auto_check: True auto_check: True
exec: exec:
- 'echo "Version: $(warn_exec mongo --version 2>/dev/null; warn_exec mongod --version 2>/dev/null)"' - 'echo "Version: $(warn_exec mongo --version 2>/dev/null; warn_exec mongod --version 2>/dev/null)"'
- if [ "$(command -v mongo)" ]; then echo "show dbs" | mongo 127.0.0.1 > /dev/null 2>&1;[ "$?" == "0" ] && echo "Possible mongo anonymous authentication" | sed -${E} "s,.*|kube,${SED_RED},"; fi
files: files:
- name: "mongod*.conf" - name: "mongod*.conf"
@@ -551,6 +574,21 @@ search:
search_in: search_in:
- common - common
- name: Rocketchat
value:
config:
auto_check: True
files:
- name: "rocketchat.service"
value:
bad_regex: "mongodb://.*"
line_grep: '-i "Environment"'
type: f
search_in:
- common
- /lib
- /systemd
- name: Supervisord - name: Supervisord
value: value:
@@ -669,6 +707,34 @@ search:
search_in: search_in:
- /etc - /etc
- name: GlusterFS
value:
config:
auto_check: True
files:
- name: "glusterfs.pem"
value:
type: f
just_list_file: True
search_in:
- common
- name: "glusterfs.ca"
value:
type: f
just_list_file: True
search_in:
- common
- name: "glusterfs.key"
value:
type: f
just_list_file: True
search_in:
- common
- name: Anaconda ks - name: Anaconda ks
value: value:
config: config:
@@ -706,31 +772,73 @@ search:
search_in: search_in:
- common - common
- name: Kubelet - name: Kubernetes
value: value:
config: config:
auto_check: True auto_check: True
exec:
- (env || set) | grep -Ei "kubernetes|kube" | grep -v "PSTORAGE_KUBERNETES|USEFUL_SOFTWARE" | sed -${E} "s,kubernetes|kube,${SED_RED},"
files: files:
- name: "kubeconfig"
value:
bad_regex: "server:|cluster:|namespace:|user:|exec:"
type: d
search_in:
- common
- name: "kubelet-kubeconfig"
value:
bad_regex: "server:|cluster:|namespace:|user:|exec:"
type: d
search_in:
- common
- name: "psk.txt"
value:
remove_empty_lines: True
bad_regex: ".*"
type: f
search_in:
- common
- name: ".kube*"
value:
files:
- name: "config"
value:
bad_regex: "server:|cluster:|namespace:|user:|exec:"
type: d
search_in:
- common
- name: "kubelet" - name: "kubelet"
value: value:
files: files:
- name: "kubeconfig" - name: "kubelet.conf"
value: value:
bad_regex: "server:|cluster:|namespace:|user:|exec:" bad_regex: "server:|cluster:|namespace:|user:|exec:"
- name: "config.yaml"
value:
bad_regex: "server:|cluster:|namespace:|user:|exec:"
- name: "kubeadm-flags.env"
value:
remove_empty_lines: True
type: d type: d
search_in: search_in:
- /var - /var
- name: "kube-proxy" - name: "kube-proxy"
value: value:
files:
- name: "kubeconfig"
value:
bad_regex: "cluster:|certificate-authority-data:|namespace:|user:|token:"
type: d type: d
search_in: search_in:
- /var - /var
- name: "kubernetes"
value:
type: d
search_in:
- /etc
- name: VNC - name: VNC
value: value:
@@ -751,6 +859,7 @@ search:
- name: "*vnc*.c*nf*" - name: "*vnc*.c*nf*"
value: value:
bad_regex: ".*" bad_regex: ".*"
remove_regex: '^#'
type: f type: f
search_in: search_in:
- common - common
@@ -940,7 +1049,6 @@ search:
type: f type: f
search_in: search_in:
- /tmp - /tmp
- /private
- name: SSH_CONFIG - name: SSH_CONFIG
value: value:
@@ -961,12 +1069,12 @@ search:
auto_check: True auto_check: True
files: files:
- name: "credentials" #- name: "credentials"
value: # value:
bad_regex: ".*" # bad_regex: ".*"
type: f # type: f
search_in: # search_in:
- common # - common
- name: "credentials.db" - name: "credentials.db"
value: value:
@@ -1515,6 +1623,37 @@ search:
type: f type: f
search_in: search_in:
- common - common
- name: "dockershim.sock"
value:
type: f
search_in:
- common
- name: "containerd.sock"
value:
type: f
search_in:
- common
- name: "crio.sock"
value:
type: f
search_in:
- common
- name: "frakti.sock"
value:
type: f
search_in:
- common
- name: "rktlet.sock"
value:
type: f
search_in:
- common
- name: Firefox - name: Firefox
value: value:
@@ -2567,7 +2706,7 @@ search:
search_in: search_in:
- common - common
- name: Other Interesting Files - name: Other Interesting
value: value:
config: config:
auto_check: True auto_check: True
@@ -2636,7 +2775,7 @@ search:
search_in: search_in:
- common - common
- name: Windows Files - name: Windows
value: value:
config: config:
auto_check: True auto_check: True
@@ -2985,7 +3124,7 @@ search:
search_in: search_in:
- common - common
- name: Other Windows Files - name: Other Windows
value: value:
config: config:
auto_check: True auto_check: True

View File

@@ -1,4 +1,4 @@
# LinPEAS - Linux Privilege Escalation Awesome Script # LinPEAS - Linux Privilege Escalation Awesome Script
![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/linPEAS/images/linpeas.png) ![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/linPEAS/images/linpeas.png)
@@ -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,29 @@ 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},"
echo ""
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 || "$(rpm -qa | grep polkit | grep -c '0.117-2\|0.115-6')" -ge 1 ]]; then
echo "Vulnerable to CVE-2021-3560" | sed -${E} "s,.*,${SED_RED_YELLOW},"
echo ""
fi
#-- SY) CVE-2022-0847
#-- https://dirtypipe.cm4all.com/
#-- https://stackoverflow.com/a/37939589
kernelversion=$(uname -r | awk -F"-" '{print $1}')
kernelnumber=$(echo $kernelversion | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }')
if [[ $kernelnumber -ge 5008000000 && $kernelnumber -lt 5017000000 ]]; then # if kernel version beteen 5.8 and 5.17
echo "Vulnerable to CVE-2022-0847" | sed -${E} "s,.*,${SED_RED_YELLOW},"
echo ""
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"
@@ -77,8 +100,8 @@ fi
if [ -f "/etc/fstab" ] || [ "$DEBUG" ]; then if [ -f "/etc/fstab" ] || [ "$DEBUG" ]; then
print_2title "Unmounted file-system?" print_2title "Unmounted file-system?"
print_info "Check if you can mount umounted devices" print_info "Check if you can mount unmounted devices"
grep -v "^#" /etc/fstab 2>/dev/null | grep -Ev "\W+\#|^#" | sed -${E} "s,$mountG,${SED_GREEN},g" | sed -${E} "s,$notmounted,${SED_RED}," | sed -${E} "s,$mounted,${SED_BLUE}," | sed -${E} "s,$Wfolders,${SED_RED}," | sed -${E} "s,$mountpermsB,${SED_RED},g" | sed -${E} "s,$mountpermsG,${SED_GREEN},g" grep -v "^#" /etc/fstab 2>/dev/null | grep -Ev "\W+\#|^#" | sed -${E} "s,$mountG,${SED_GREEN},g" | sed -${E} "s,$notmounted,${SED_RED},g" | sed -${E} "s%$mounted%${SED_BLUE}%g" | sed -${E} "s,$Wfolders,${SED_RED}," | sed -${E} "s,$mountpermsB,${SED_RED},g" | sed -${E} "s,$mountpermsG,${SED_GREEN},g"
echo "" echo ""
fi fi
@@ -97,7 +120,7 @@ fi
#-- SY) Environment vars #-- SY) Environment vars
print_2title "Environment" print_2title "Environment"
print_info "Any private information inside environment variables?" print_info "Any private information inside environment variables?"
(env || printenv || set) 2>/dev/null | grep -v "RELEVANT*|FIND*|^VERSION=|dbuslistG|mygroups|ldsoconfdG|pwd_inside_history|kernelDCW_Ubuntu_Precise|kernelDCW_Ubuntu_Trusty|kernelDCW_Ubuntu_Xenial|kernelDCW_Rhel|^sudovB=|^rootcommon=|^mounted=|^mountG=|^notmounted=|^mountpermsB=|^mountpermsG=|^kernelB=|^C=|^RED=|^GREEN=|^Y=|^B=|^NC=|TIMEOUT=|groupsB=|groupsVB=|knw_grps=|sidG|sidB=|sidVB=|sidVB2=|sudoB=|sudoG=|sudoVB=|timersG=|capsB=|notExtensions=|Wfolders=|writeB=|writeVB=|_usrs=|compiler=|PWD=|LS_COLORS=|pathshG=|notBackup=|processesDump|processesB|commonrootdirs|USEFUL_SOFTWARE|PSTORAGE_KUBELET" | sed -${E} "s,[pP][wW][dD]|[pP][aA][sS][sS][wW]|[aA][pP][iI][kK][eE][yY]|[aA][pP][iI][_][kK][eE][yY]|KRB5CCNAME,${SED_RED},g" || echo_not_found "env || set" (env || printenv || set) 2>/dev/null | grep -v "RELEVANT*|FIND*|^VERSION=|dbuslistG|mygroups|ldsoconfdG|pwd_inside_history|kernelDCW_Ubuntu_Precise|kernelDCW_Ubuntu_Trusty|kernelDCW_Ubuntu_Xenial|kernelDCW_Rhel|^sudovB=|^rootcommon=|^mounted=|^mountG=|^notmounted=|^mountpermsB=|^mountpermsG=|^kernelB=|^C=|^RED=|^GREEN=|^Y=|^B=|^NC=|TIMEOUT=|groupsB=|groupsVB=|knw_grps=|sidG|sidB=|sidVB=|sidVB2=|sudoB=|sudoG=|sudoVB=|timersG=|capsB=|notExtensions=|Wfolders=|writeB=|writeVB=|_usrs=|compiler=|PWD=|LS_COLORS=|pathshG=|notBackup=|processesDump|processesB|commonrootdirs|USEFUL_SOFTWARE" | sed -${E} "s,[pP][wW][dD]|[pP][aA][sS][sS][wW]|[aA][pP][iI][kK][eE][yY]|[aA][pP][iI][_][kK][eE][yY]|KRB5CCNAME,${SED_RED},g" || echo_not_found "env || set"
echo "" echo ""
#-- SY) Dmesg #-- SY) Dmesg
@@ -125,7 +148,7 @@ if [ "$(command -v bash 2>/dev/null)" ]; then
if [ "$EXTRA_CHECKS" ]; then if [ "$EXTRA_CHECKS" ]; then
echo $les_b64 | base64 -d | bash -s -- --checksec | sed "s,$(printf '\033')\\[[0-9;]*[a-zA-Z],,g" | sed -E "s,\[CVE-[0-9]+-[0-9]+\].*,${SED_RED},g" echo $les_b64 | base64 -d | bash -s -- --checksec | sed "s,$(printf '\033')\\[[0-9;]*[a-zA-Z],,g" | sed -E "s,\[CVE-[0-9]+-[0-9]+\].*,${SED_RED},g"
else else
echo $les_b64 | base64 -d | bash | sed "s,$(printf '\033')\\[[0-9;]*[a-zA-Z],,g" | grep -i "\[CVE" -A 10 | grep -Ev "^\-\-$" | sed -${E} "s,\[CVE-[0-9]+-[0-9]+\],*,${SED_RED},g" echo $les_b64 | base64 -d | bash | sed "s,$(printf '\033')\\[[0-9;]*[a-zA-Z],,g" | grep -i "\[CVE" -A 10 | grep -Ev "^\-\-$" | sed -${E} "s,\[CVE-[0-9]+-[0-9]+\].*,${SED_RED},g"
fi fi
echo "" echo ""
fi fi

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
@@ -303,4 +303,4 @@ if [ "$dbuslist" ]; then
fi fi
done done
else echo_not_found "busctl" else echo_not_found "busctl"
fi fi

View File

@@ -60,15 +60,15 @@ 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
echo "You can create a file in /etc/sudoers.d/ and escalate privileges" | sed -${E} "s,.*,${SED_RED_YELLOW}," echo "You can create a file in /etc/sudoers.d/ and escalate privileges" | sed -${E} "s,.*,${SED_RED_YELLOW},"
fi fi
for filename in '/etc/sudoers.d/*'; do for filename in /etc/sudoers.d/*; do
if [ -r "$filename" ]; then if [ -r "$filename" ]; then
echo "Sudoers file: $filename is readable" | sed -${E} "s,.*,${SED_RED},g" echo "Sudoers file: $filename is readable" | sed -${E} "s,.*,${SED_RED},g"
grep -Iv "^$" "$filename" | 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}," grep -Iv "^$" "$filename" | 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},"
@@ -228,4 +228,4 @@ if ! [ "$FAST" ] && ! [ "$SUPERFAST" ] && [ "$TIMEOUT" ] && ! [ "$IAMROOT" ] &&
else else
print_2title "Do not forget to test 'su' as any other user with shell: without password and with their names as password (I can't do it...)\n"$NC print_2title "Do not forget to test 'su' as any other user with shell: without password and with their names as password (I can't do it...)\n"$NC
fi fi
print_2title "Do not forget to execute 'sudo -l' without password or with valid password (if you know it)!!\n"$NC print_2title "Do not forget to execute 'sudo -l' without password or with valid password (if you know it)!!\n"$NC

View File

@@ -2,6 +2,8 @@
#--------) Software Information (---------# #--------) Software Information (---------#
########################################### ###########################################
NGINX_KNOWN_MODULES="ngx_http_geoip_module.so|ngx_http_xslt_filter_module.so|ngx_stream_geoip_module.so|ngx_http_image_filter_module.so|ngx_mail_module.so|ngx_stream_module.so"
#-- SI) Useful software #-- SI) Useful software
print_2title "Useful software" print_2title "Useful software"
for tool in $USEFUL_SOFTWARE; do command -v "$tool"; done for tool in $USEFUL_SOFTWARE; do command -v "$tool"; done
@@ -78,30 +80,46 @@ fi
if [ "$PSTORAGE_MYSQL" ] || [ "$DEBUG" ]; then if [ "$PSTORAGE_MYSQL" ] || [ "$DEBUG" ]; then
print_2title "Searching mysql credentials and exec" print_2title "Searching mysql credentials and exec"
printf "%s\n" "$PSTORAGE_MYSQL" | while read d; do printf "%s\n" "$PSTORAGE_MYSQL" | while read d; do
for f in $(find $d -name debian.cnf 2>/dev/null); do if [ -f "$d" ]; then
if [ -r "$f" ]; then STRINGS="`command -v strings`"
echo "We can read the mysql debian.cnf. You can use this username/password to log in MySQL" | sed -${E} "s,.*,${SED_RED}," echo "Potential file containing credentials:"
cat "$f" ls -l "$d"
if [ "$STRINGS" ]; then
strings "$d"
else
echo "Strings not found, cat the file and check it to get the creds"
fi fi
done
for f in $(find $d -name user.MYD 2>/dev/null); do else
if [ -r "$f" ]; then for f in $(find $d -name debian.cnf 2>/dev/null); do
echo "We can read the Mysql Hashes from $f" | sed -${E} "s,.*,${SED_RED}," if [ -r "$f" ]; then
grep -oaE "[-_\.\*a-Z0-9]{3,}" $f | grep -v "mysql_native_password" echo "We can read the mysql debian.cnf. You can use this username/password to log in MySQL" | sed -${E} "s,.*,${SED_RED},"
fi cat "$f"
done fi
for f in $(grep -lr "user\s*=" $d 2>/dev/null | grep -v "debian.cnf"); do done
if [ -r "$f" ]; then
u=$(cat "$f" | grep -v "#" | grep "user" | grep "=" 2>/dev/null) for f in $(find $d -name user.MYD 2>/dev/null); do
echo "From '$f' Mysql user: $u" | sed -${E} "s,$sh_usrs,${SED_LIGHT_CYAN}," | sed -${E} "s,$nosh_usrs,${SED_BLUE}," | sed -${E} "s,$knw_usrs,${SED_GREEN}," | sed "s,$USER,${SED_LIGHT_MAGENTA}," | sed "s,root,${SED_RED}," if [ -r "$f" ]; then
fi echo "We can read the Mysql Hashes from $f" | sed -${E} "s,.*,${SED_RED},"
done grep -oaE "[-_\.\*a-Z0-9]{3,}" "$f" | grep -v "mysql_native_password"
for f in $(find $d -name my.cnf 2>/dev/null); do fi
if [ -r "$f" ]; then done
echo "Found readable $f"
grep -v "^#" "$f" | grep -Ev "\W+\#|^#" 2>/dev/null | grep -Iv "^$" | sed "s,password.*,${SED_RED}," for f in $(grep -lr "user\s*=" $d 2>/dev/null | grep -v "debian.cnf"); do
fi if [ -r "$f" ]; then
done u=$(cat "$f" | grep -v "#" | grep "user" | grep "=" 2>/dev/null)
echo "From '$f' Mysql user: $u" | sed -${E} "s,$sh_usrs,${SED_LIGHT_CYAN}," | sed -${E} "s,$nosh_usrs,${SED_BLUE}," | sed -${E} "s,$knw_usrs,${SED_GREEN}," | sed "s,$USER,${SED_LIGHT_MAGENTA}," | sed "s,root,${SED_RED},"
fi
done
for f in $(find $d -name my.cnf 2>/dev/null); do
if [ -r "$f" ]; then
echo "Found readable $f"
grep -v "^#" "$f" | grep -Ev "\W+\#|^#" 2>/dev/null | grep -Iv "^$" | sed "s,password.*,${SED_RED},"
fi
done
fi
mysqlexec=$(whereis lib_mysqludf_sys.so 2>/dev/null | grep "lib_mysqludf_sys\.so") mysqlexec=$(whereis lib_mysqludf_sys.so 2>/dev/null | grep "lib_mysqludf_sys\.so")
if [ "$mysqlexec" ]; then if [ "$mysqlexec" ]; then
echo "Found $mysqlexec" echo "Found $mysqlexec"
@@ -142,7 +160,7 @@ fi
peass{Mongo} peass{Mongo}
peass{Apache} peass{Apache-Nginx}
peass{Tomcat} peass{Tomcat}
@@ -192,7 +210,7 @@ if [ "$PSTORAGE_CERTSB4" ]; then certsb4_grep=$(grep -L "\"\|'\|(" $PSTORAGE_CER
sshconfig="$(ls /etc/ssh/ssh_config 2>/dev/null)" sshconfig="$(ls /etc/ssh/ssh_config 2>/dev/null)"
hostsdenied="$(ls /etc/hosts.denied 2>/dev/null)" hostsdenied="$(ls /etc/hosts.denied 2>/dev/null)"
hostsallow="$(ls /etc/hosts.allow 2>/dev/null)" hostsallow="$(ls /etc/hosts.allow 2>/dev/null)"
writable_agents=$(find $folder_path -type s -name "agent.*" -or -name "*gpg-agent*" '(' '(' -user $USER ')' -or '(' -perm -o=w ')' -or '(' -perm -g=w -and '(' $wgroups ')' ')' ')') writable_agents=$(find /tmp /etc /home -type s -name "agent.*" -or -name "*gpg-agent*" '(' '(' -user $USER ')' -or '(' -perm -o=w ')' -or '(' -perm -g=w -and '(' $wgroups ')' ')' ')' 2>/dev/null)
peass{SSH} peass{SSH}
@@ -548,25 +566,17 @@ fi
#-- SI) Docker #-- SI) Docker
if [ "$PSTORAGE_DOCKER" ] || [ "$DEBUG" ]; then if [ "$PSTORAGE_DOCKER" ] || [ "$DEBUG" ]; then
print_2title "Searching docker files (limit 70)" print_2title "Searching docker files (limit 70)"
print_info "https://book.hacktricks.xyz/linux-unix/privilege-escalation#writable-docker-socket" print_info "https://book.hacktricks.xyz/linux-unix/privilege-escalation/docker-breakout/docker-breakout-privilege-escalation"
printf "%s\n" "$PSTORAGE_DOCKER" | head -n 70 | while read f; do printf "%s\n" "$PSTORAGE_DOCKER" | head -n 70 | while read f; do
ls -l "$f" 2>/dev/null ls -l "$f" 2>/dev/null
if ! [ "$IAMROOT" ] && [ -S "$f" ] && [ -w "$f" ]; then if ! [ "$IAMROOT" ] && [ -S "$f" ] && [ -w "$f" ]; then
echo "Docker socket file ($f) is writable" | sed -${E} "s,.*,${SED_RED_YELLOW}," echo "Docker related socket ($f) is writable" | sed -${E} "s,.*,${SED_RED_YELLOW},"
fi fi
done done
echo "" echo ""
fi fi
if [ -d "$HOME/.kube" ] || [ -d "/etc/kubernetes" ] || [ -d "/var/lib/localkube" ] || [ "`(env | set) | grep -Ei 'kubernetes|kube' | grep -v "PSTORAGE_KUBELET|USEFUL_SOFTWARE"`" ] || [ "$DEBUG" ]; then peass{Kubernetes}
print_2title "Kubernetes information" | sed -${E} "s,config,${SED_RED},"
ls -l "$HOME/.kube" 2>/dev/null
grep -ERH "client-secret:|id-token:|refresh-token:" "$HOME/.kube" 2>/dev/null | sed -${E} "s,client-secret:.*|id-token:.*|refresh-token:.*,${SED_RED},"
(env || set) | grep -Ei "kubernetes|kube" | grep -v "PSTORAGE_KUBELET|USEFUL_SOFTWARE" | sed -${E} "s,kubernetes|kube,${SED_RED},"
ls -Rl /etc/kubernetes /var/lib/localkube 2>/dev/null
fi
peass{Kubelet}
peass{Firefox} peass{Firefox}
@@ -622,6 +632,20 @@ peass{EXTRA_SECTIONS}
peass{Interesting logs} peass{Interesting logs}
peass{Windows Files} peass{Windows}
peass{Other Interesting Files} peass{Other Interesting}
if ! [ "$FAST" ] && ! [ "$SUPERFAST" ] && [ "$TIMEOUT" ]; then
print_2title "Checking leaks in git repositories"
printf "%s\n" "$PSTORAGE_GITHUB" | while read f; do
if echo "$f" | grep -Eq ".git$"; then
git_dirname=$(dirname "$f")
if [ "$MACPEAS" ]; then
execBin "GitLeaks (checking $git_dirname)" "https://github.com/zricethezav/gitleaks" "$FAT_LINPEAS_GITLEAKS_MACOS" "detect -s '$git_dirname' -v | grep -E 'Description|Match|Secret|Message|Date'"
else
execBin "GitLeaks (checking $git_dirname)" "https://github.com/zricethezav/gitleaks" "$FAT_LINPEAS_GITLEAKS_LINUX" "detect -s '$git_dirname' -v | grep -E 'Description|Match|Secret|Message|Date'"
fi
fi
done
fi

View File

@@ -257,12 +257,18 @@ if [ "$broken_links" ] || [ "$DEBUG" ]; then
echo "" echo ""
fi fi
if [ "$MACPEAS" ]; then if [ "$MACPEAS" ]; then
print_2title "Unsigned Applications" print_2title "Unsigned Applications"
macosNotSigned /System/Applications macosNotSigned /System/Applications
fi fi
##-- IF) Unexpected in /opt
if [ "$(ls /opt 2>/dev/null)" ]; then
print_2title "Unexpected in /opt (usually empty)"
ls -la /opt
echo ""
fi
##-- IF) Unexpected folders in / ##-- IF) Unexpected folders in /
print_2title "Unexpected in root" print_2title "Unexpected in root"
if [ "$MACPEAS" ]; then if [ "$MACPEAS" ]; then

View File

@@ -220,7 +220,7 @@ print_support () {
|---------------------------------------------------------------------------| |---------------------------------------------------------------------------|
| ${YELLOW}Become a Patreon${GREEN} : ${RED}https://www.patreon.com/peass${GREEN} | | ${YELLOW}Become a Patreon${GREEN} : ${RED}https://www.patreon.com/peass${GREEN} |
| ${YELLOW}Follow on Twitter${GREEN} : ${RED}@carlospolopm${GREEN} | | ${YELLOW}Follow on Twitter${GREEN} : ${RED}@carlospolopm${GREEN} |
| ${YELLOW}Respect on HTB${GREEN} : ${RED}SirBroccoli & makikvues${GREEN} | | ${YELLOW}Respect on HTB${GREEN} : ${RED}SirBroccoli ${GREEN} |
|---------------------------------------------------------------------------| |---------------------------------------------------------------------------|
| ${BLUE}Thank you! ${GREEN} | | ${BLUE}Thank you! ${GREEN} |
\---------------------------------------------------------------------------/ \---------------------------------------------------------------------------/

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

@@ -1,14 +1,15 @@
# Privilege Escalation Awesome Scripts JSON exporter # Privilege Escalation Awesome Scripts Parsers
This script allows you to transform the output of linpeas/macpeas/winpeas to JSON. These scripts allows you to transform the output of linpeas/macpeas/winpeas to JSON and then to PDF and HTML.
```python3 ```python3
python3 peass-parser.py </path/to/executed_peass> </path/to/output_peass.json> python3 peass2json.py </path/to/executed_peass.out> </path/to/peass.json>
python3 json2pdf.py </path/to/peass.json> </path/to/peass.pdf>
python3 json2html.py </path/to/peass.json> </path/to/peass.html>
``` ```
This script is still in beta version and has been tested only with linpeas output.
## Format ## JSON Format
Basically, **each section has**: Basically, **each section has**:
- Infos (URLs or info about the section) - Infos (URLs or info about the section)
- Text lines (the real text info found in the section, colors included) - Text lines (the real text info found in the section, colors included)
@@ -75,4 +76,4 @@ There can also be a `<Third level Section Name>`
# TODO: # TODO:
I'm looking for **someone that could create HTML and PDF reports** from this JSON. - **PRs improving the code and the aspect of the final PDFs and HTMLs are always welcome!**

347
parsers/json2html.py Normal file

File diff suppressed because one or more lines are too long

162
parsers/json2pdf.py Executable file
View File

@@ -0,0 +1,162 @@
#!/usr/bin/env python3
import sys
import json
import html
from reportlab.lib.pagesizes import letter
from reportlab.platypus import Frame, Paragraph, Spacer, PageBreak,PageTemplate, BaseDocTemplate
from reportlab.platypus.tableofcontents import TableOfContents
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
styles = getSampleStyleSheet()
text_colors = { "GREEN": "#00DB00", "RED": "#FF0000", "REDYELLOW": "#FFA500", "BLUE": "#0000FF",
"DARKGREY": "#5C5C5C", "YELLOW": "#ebeb21", "MAGENTA": "#FF00FF", "CYAN": "#00FFFF", "LIGHT_GREY": "#A6A6A6"}
# Required to automatically set Page Numbers
class PageTemplateWithCount(PageTemplate):
def __init__(self, id, frames, **kw):
PageTemplate.__init__(self, id, frames, **kw)
def beforeDrawPage(self, canvas, doc):
page_num = canvas.getPageNumber()
canvas.drawRightString(10.5*cm, 1*cm, str(page_num))
# Required to automatically set the Table of Contents
class MyDocTemplate(BaseDocTemplate):
def __init__(self, filename, **kw):
self.allowSplitting = 0
BaseDocTemplate.__init__(self, filename, **kw)
template = PageTemplateWithCount("normal", [Frame(2.5*cm, 2.5*cm, 15*cm, 25*cm, id='F1')])
self.addPageTemplates(template)
def afterFlowable(self, flowable):
if flowable.__class__.__name__ == "Paragraph":
text = flowable.getPlainText()
style = flowable.style.name
if style == "Heading1":
self.notify("TOCEntry", (0, text, self.page))
if style == "Heading2":
self.notify("TOCEntry", (1, text, self.page))
if style == "Heading3":
self.notify("TOCEntry", (2, text, self.page))
# Poor take at dynamicly generating styles depending on depth(?)
def get_level_styles(level):
global styles
indent_value = 10 * (level - 1);
# Overriding some default stylings
level_styles = {
"title": ParagraphStyle(
**dict(styles[f"Heading{level}"].__dict__,
**{ "leftIndent": indent_value })),
"text": ParagraphStyle(
**dict(styles["Code"].__dict__,
**{ "backColor": "#F0F0F0",
"borderPadding": 5, "borderWidth": 1,
"borderColor": "black", "borderRadius": 5,
"leftIndent": 5 + indent_value})),
"info": ParagraphStyle(
**dict(styles["Italic"].__dict__,
**{ "leftIndent": indent_value })),
}
return level_styles
def get_colors_by_text(colors):
new_colors = {}
for (color, words) in colors.items():
for word in words:
new_colors[html.escape(word)] = color
return new_colors
def build_main_section(section, title, level=1):
styles = get_level_styles(level)
has_links = "infos" in section.keys() and len(section["infos"]) > 0
has_lines = "lines" in section.keys() and len(section["lines"]) > 1
has_children = "sections" in section.keys() and len(section["sections"].keys()) > 0
# Only display data for Sections with results
show_section = has_lines or has_children
elements = []
if show_section:
elements.append(Paragraph(title, style=styles["title"]))
# Print info if any
if show_section and has_links:
for info in section["infos"]:
words = info.split()
# Join all lines and encode any links that might be present.
words = map(lambda word: f'<a href="{word}" color="blue">{word}</a>' if "http" in word else word, words)
words = " ".join(words)
elements.append(Paragraph(words, style=styles["info"] ))
# Print lines if any
if "lines" in section.keys() and len(section["lines"]) > 1:
colors_by_line = list(map(lambda x: x["colors"], section["lines"]))
lines = list(map(lambda x: html.escape(x["clean_text"]), section["lines"]))
for (idx, line) in enumerate(lines):
colors = colors_by_line[idx]
colored_text = get_colors_by_text(colors)
colored_line = line
for (text, color) in colored_text.items():
if color == "REDYELLOW":
colored_line = colored_line.replace(text, f'<font color="{text_colors[color]}"><b>{text}</b></font>')
else:
colored_line = colored_line.replace(text, f'<font color="{text_colors[color]}">{text}</font>')
lines[idx] = colored_line
elements.append(Spacer(0, 10))
line = "<br/>".join(lines)
# If it's a top level entry remove the line break caused by an empty "clean_text"
if level == 1: line = line[5:]
elements.append(Paragraph(line, style=styles["text"]))
# Print child sections
if has_children:
for child_title in section["sections"].keys():
element_list = build_main_section(section["sections"][child_title], child_title, level + 1)
elements.extend(element_list)
# Add spacing at the end of section. The deeper the level the smaller the spacing.
if show_section:
elements.append(Spacer(1, 40 - (10 * level)))
return elements
def main():
with open(JSON_PATH) as file:
# Read and parse JSON file
data = json.loads(file.read())
# Default pdf values
doc = MyDocTemplate(PDF_PATH)
toc = TableOfContents()
toc.levelStyles = [
ParagraphStyle(name = "Heading1", fontSize = 14, leading=16),
ParagraphStyle(name = "Heading2", fontSize = 12, leading=14, leftIndent = 10),
ParagraphStyle(name = "Heading3", fontSize = 10, leading=12, leftIndent = 20),
]
elements = [Paragraph("PEAS Report", style=styles["Title"]), Spacer(0, 30), toc, PageBreak()]
# Iterate over all top level sections and build their elements.
for title in data.keys():
element_list = build_main_section(data[title], title)
elements.extend(element_list)
doc.multiBuild(elements)
# Start execution
if __name__ == "__main__":
try:
JSON_PATH = sys.argv[1]
PDF_PATH = sys.argv[2]
except IndexError as err:
print("Error: Please pass the peas.json file and the path to save the pdf\njson2pdf.py <json_file> <pdf_file.pdf>")
sys.exit(1)
main()

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", "").replace("[3m", "") #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,13 +139,13 @@ 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))
}) })
def main(): def main():
for line in open(OUTPUT_PATH, 'r').readlines(): for line in open(OUTPUT_PATH, 'r', encoding="utf8").readlines():
line = line.strip() line = line.strip()
if not line or not clean_colors(line): #Remove empty lines or lines just with colors hex if not line or not clean_colors(line): #Remove empty lines or lines just with colors hex
continue continue
@@ -147,7 +162,7 @@ if __name__ == "__main__":
OUTPUT_PATH = sys.argv[1] OUTPUT_PATH = sys.argv[1]
JSON_PATH = sys.argv[2] JSON_PATH = sys.argv[2]
except IndexError as err: except IndexError as err:
print("Error: Please pass the peas.out file and the path to save the json\n./peas-parser.py <output_file> <json_file.json>") print("Error: Please pass the peas.out file and the path to save the json\npeas2json.py <output_file> <json_file.json>")
sys.exit(1) sys.exit(1)
main() main()

View File

@@ -1,29 +1,29 @@
# Windows Privilege Escalation Awesome Scripts # Windows Privilege Escalation Awesome Scripts
![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/winpeas.png) ![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/winpeas.png)
Check the **Local Windows Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/checklist-windows-privilege-escalation)** Check the **Local Windows Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/checklist-windows-privilege-escalation)**
Check more **information about how to exploit** found misconfigurations in **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/windows-local-privilege-escalation)** Check more **information about how to exploit** found misconfigurations in **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/windows-local-privilege-escalation)**
## Quick Start ## Quick Start
Find the **latest versions of all the scripts and binaries in [the releases page](https://github.com/carlospolop/PEASS-ng/releases/latest)**. Find the **latest versions of all the scripts and binaries in [the releases page](https://github.com/carlospolop/PEASS-ng/releases/latest)**.
## WinPEAS .exe and .bat ## WinPEAS .exe and .bat
- [Link to WinPEAS .bat project](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS/winPEASbat) - [Link to WinPEAS .bat project](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS/winPEASbat)
- [Link to WinPEAS C# project (.exe)](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS/winPEASexe) (.Net >= 4.5.2 required) - [Link to WinPEAS C# project (.exe)](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS/winPEASexe) (.Net >= 4.5.2 required)
- **Please, read the Readme of that folder to learn how to execute winpeas from memory or how make colors work among other tricks** - **Please, read the Readme of that folder to learn how to execute winpeas from memory or how make colors work among other tricks**
## Please, if this tool has been useful for you consider to donate ## Please, if this tool has been useful for you consider to donate
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.patreon.com/peass) [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.patreon.com/peass)
## PEASS Style ## PEASS Style
Are you a PEASS fan? Get now our merch at **[PEASS Shop](https://teespring.com/stores/peass)** and show your love for our favorite peas Are you a PEASS fan? Get now our merch at **[PEASS Shop](https://teespring.com/stores/peass)** and show your love for our favorite peas
## Advisory ## Advisory
All the scripts/binaries of the PEAS Suite should be used for authorized penetration testing and/or educational purposes only. Any misuse of this software will not be the responsibility of the author or of any other collaborator. Use it at your own networks and/or with the network owner's permission. All the scripts/binaries of the PEAS Suite should be used for authorized penetration testing and/or educational purposes only. Any misuse of this software will not be the responsibility of the author or of any other collaborator. Use it at your own networks and/or with the network owner's permission.
By Polop<sup>(TM)</sup> By Polop<sup>(TM)</sup>

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

@@ -1,288 +1,288 @@
# Windows Privilege Escalation Awesome Script (.exe) # Windows Privilege Escalation Awesome Script (.exe)
![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/winpeas.png) ![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/winpeas.png)
**WinPEAS is a script that search for possible paths to escalate privileges on Windows hosts. The checks are explained on [book.hacktricks.xyz](https://book.hacktricks.xyz/windows/windows-local-privilege-escalation)** **WinPEAS is a script that search for possible paths to escalate privileges on Windows hosts. The checks are explained on [book.hacktricks.xyz](https://book.hacktricks.xyz/windows/windows-local-privilege-escalation)**
Check also the **Local Windows Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/checklist-windows-privilege-escalation)** Check also the **Local Windows Privilege Escalation checklist** from **[book.hacktricks.xyz](https://book.hacktricks.xyz/windows/checklist-windows-privilege-escalation)**
[![youtube](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/screen.png)](https://youtu.be/66gOwXMnxRI) [![youtube](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/screen.png)](https://youtu.be/66gOwXMnxRI)
## Quick Start ## Quick Start
**.Net >= 4.5.2 is required** **.Net >= 4.5.2 is required**
Precompiled binaries: Precompiled binaries:
- Download the **[latest obfuscated and not obfuscated versions from here](https://github.com/carlospolop/PEASS-ng/releases/latest)** or **compile it yourself** (read instructions for compilation). - Download the **[latest obfuscated and not obfuscated versions from here](https://github.com/carlospolop/PEASS-ng/releases/latest)** or **compile it yourself** (read instructions for compilation).
```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 # One liner to download and execute winPEASany from memory in a PS shell
$url = "https://github.com/carlospolop/PEASS-ng/releases/download/$latestVersion/winPEASany.exe" $wp=[System.Reflection.Assembly]::Load([byte[]](Invoke-WebRequest "$url" -UseBasicParsing | Select-Object -ExpandProperty Content)); [winPEAS.Program]::Main("")
# One liner to download and execute winPEASany from memory in a PS shell # Before cmd in 3 lines
$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("") #Put inside the quotes the winpeas parameters you want to use
# Before cmd in 3 lines
$wp=[System.Reflection.Assembly]::Load([byte[]](Invoke-WebRequest "$url" -UseBasicParsing | Select-Object -ExpandProperty Content)); # Load from disk in memory and execute:
[winPEAS.Program]::Main("") #Put inside the quotes the winpeas parameters you want to use $wp = [System.Reflection.Assembly]::Load([byte[]]([IO.File]::ReadAllBytes("D:\Users\victim\winPEAS.exe")));
[winPEAS.Program]::Main("") #Put inside the quotes the winpeas parameters you want to use
# Load from disk in memory and execute:
$wp = [System.Reflection.Assembly]::Load([byte[]]([IO.File]::ReadAllBytes("D:\Users\victim\winPEAS.exe"))); # Load from disk in base64 and execute
[winPEAS.Program]::Main("") #Put inside the quotes the winpeas parameters you want to use ##Generate winpeas in Base64:
[Convert]::ToBase64String([IO.File]::ReadAllBytes("D:\Users\user\winPEAS.exe")) | Out-File -Encoding ASCII D:\Users\user\winPEAS.txt
# Load from disk in base64 and execute ##Now upload the B64 string to the victim inside a file or copy it to the clipboard
##Generate winpeas in Base64:
[Convert]::ToBase64String([IO.File]::ReadAllBytes("D:\Users\user\winPEAS.exe")) | Out-File -Encoding ASCII D:\Users\user\winPEAS.txt ##If you have uploaded the B64 as afile load it with:
##Now upload the B64 string to the victim inside a file or copy it to the clipboard $thecontent = Get-Content -Path D:\Users\victim\winPEAS.txt
##If you have copied the B64 to the clipboard do:
##If you have uploaded the B64 as afile load it with: $thecontent = "aaaaaaaa..." #Where "aaa..." is the winpeas base64 string
$thecontent = Get-Content -Path D:\Users\victim\winPEAS.txt ##Finally, load binary in memory and execute
##If you have copied the B64 to the clipboard do: $wp = [System.Reflection.Assembly]::Load([Convert]::FromBase64String($thecontent))
$thecontent = "aaaaaaaa..." #Where "aaa..." is the winpeas base64 string [winPEAS.Program]::Main("") #Put inside the quotes the winpeas parameters you want to use
##Finally, load binary in memory and execute
$wp = [System.Reflection.Assembly]::Load([Convert]::FromBase64String($thecontent)) # Loading from file and executing a winpeas obfuscated version
[winPEAS.Program]::Main("") #Put inside the quotes the winpeas parameters you want to use ##Load obfuscated version
$wp = [System.Reflection.Assembly]::Load([byte[]]([IO.File]::ReadAllBytes("D:\Users\victim\winPEAS-Obfuscated.exe")));
# Loading from file and executing a winpeas obfuscated version $wp.EntryPoint #Get the name of the ReflectedType, in obfuscated versions sometimes this is different from "winPEAS.Program"
##Load obfuscated version [<ReflectedType_from_before>]::Main("") #Used the ReflectedType name to execute winpeas
$wp = [System.Reflection.Assembly]::Load([byte[]]([IO.File]::ReadAllBytes("D:\Users\victim\winPEAS-Obfuscated.exe"))); ```
$wp.EntryPoint #Get the name of the ReflectedType, in obfuscated versions sometimes this is different from "winPEAS.Program"
[<ReflectedType_from_before>]::Main("") #Used the ReflectedType name to execute winpeas ## Parameters Examples
```
```bash
## Parameters Examples winpeas.exe #run all checks (except for additional slower checks - LOLBAS and linpeas.sh in WSL) (noisy - CTFs)
winpeas.exe systeminfo userinfo #Only systeminfo and userinfo checks executed
```bash winpeas.exe notcolor #Do not color the output
winpeas.exe #run all checks (except for additional slower checks - LOLBAS and linpeas.sh in WSL) (noisy - CTFs) winpeas.exe domain #enumerate also domain information
winpeas.exe systeminfo userinfo #Only systeminfo and userinfo checks executed winpeas.exe wait #wait for user input between tests
winpeas.exe notcolor #Do not color the output winpeas.exe debug #display additional debug information
winpeas.exe domain #enumerate also domain information winpeas.exe log #log output to out.txt instead of standard output
winpeas.exe wait #wait for user input between tests winpeas.exe -linpeas=http://127.0.0.1/linpeas.sh #Execute also additional linpeas check (runs linpeas.sh in default WSL distribution) with custom linpeas.sh URL (if not provided, the default URL is: https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh)
winpeas.exe debug #display additional debug information winpeas.exe -lolbas #Execute also additional LOLBAS search check
winpeas.exe log #log output to out.txt instead of standard output ```
winpeas.exe -linpeas=http://127.0.0.1/linpeas.sh #Execute also additional linpeas check (runs linpeas.sh in default WSL distribution) with custom linpeas.sh URL (if not provided, the default URL is: https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh)
winpeas.exe -lolbas #Execute also additional LOLBAS search check ## Help
``` ```
quiet Do not print banner
## Help notcolor Don't use ansi colors (all white)
``` systeminfo Search system information
quiet Do not print banner userinfo Search user information
notcolor Don't use ansi colors (all white) processinfo Search processes information
systeminfo Search system information servicesinfo Search services information
userinfo Search user information applicationsinfo Search installed applications information
processinfo Search processes information networkinfo Search network information
servicesinfo Search services information windowscreds Search windows credentials
applicationsinfo Search installed applications information browserinfo Search browser information
networkinfo Search network information filesinfo Search files that can contains credentials
windowscreds Search windows credentials eventsinfo Display interesting events information
browserinfo Search browser information wait Wait for user input between checks
filesinfo Search files that can contains credentials debug Display debugging information - memory usage, method execution time
eventsinfo Display interesting events information log=[logfile] Log all output to file defined as logfile, or to "out.txt" if not specified
wait Wait for user input between checks
debug Display debugging information - memory usage, method execution time Additional checks (slower):
log=[logfile] Log all output to file defined as logfile, or to "out.txt" if not specified -lolbas Run additional LOLBAS check
-linpeas=[url] Run additional linpeas.sh check for default WSL distribution, optionally provide custom linpeas.sh URL
Additional checks (slower): (default: https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh)
-lolbas Run additional LOLBAS check ```
-linpeas=[url] Run additional linpeas.sh check for default WSL distribution, optionally provide custom linpeas.sh URL
(default: https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh) ## Basic information
```
The goal of this project is to search for possible **Privilege Escalation Paths** in Windows environments.
## Basic information
It should take only a **few seconds** to execute almost all the checks and **some seconds/minutes during the lasts checks searching for known filenames** that could contain passwords (the time depened on the number of files in your home folder). By default only **some** filenames that could contain credentials are searched, you can use the **searchall** parameter to search all the list (this could will add some minutes).
The goal of this project is to search for possible **Privilege Escalation Paths** in Windows environments.
The tool is based on **[SeatBelt](https://github.com/GhostPack/Seatbelt)**.
It should take only a **few seconds** to execute almost all the checks and **some seconds/minutes during the lasts checks searching for known filenames** that could contain passwords (the time depened on the number of files in your home folder). By default only **some** filenames that could contain credentials are searched, you can use the **searchall** parameter to search all the list (this could will add some minutes).
## Where are my COLORS?!?!?!
The tool is based on **[SeatBelt](https://github.com/GhostPack/Seatbelt)**.
The **ouput will be colored** using **ansi** colors. If you are executing `winpeas.exe` **from a Windows console**, you need to set a registry value to see the colors (and open a new CMD):
## Where are my COLORS?!?!?! ```
REG ADD HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1
The **ouput will be colored** using **ansi** colors. If you are executing `winpeas.exe` **from a Windows console**, you need to set a registry value to see the colors (and open a new CMD): ```
```
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).
```
![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/colors.png)
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).
## 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.
To use **dotfuscator** you will need to **create an account** *(they will send you an email to the address you set during registration*).
To use **dotfuscator** you will need to **create an account** *(they will send you an email to the address you set during registration*).
Once you have installed and activated it you need to:
1. **Compile** winpeas in VisualStudio Once you have installed and activated it you need to:
2. **Open dotfuscator** app 1. **Compile** winpeas in VisualStudio
3. **Open** in dotfuscator **winPEAS.exe compiled** 2. **Open dotfuscator** app
4. Click on **Build** 3. **Open** in dotfuscator **winPEAS.exe compiled**
5. The **single, minimized and obfuscated binary** will appear in a **folder called Dotfuscator inside the folder were winPEAS.exe** and the DLL were (this location will be saved by dotfuscator and by default all the following builds will appear in this folder). 4. Click on **Build**
5. The **single, minimized and obfuscated binary** will appear in a **folder called Dotfuscator inside the folder were winPEAS.exe** and the DLL were (this location will be saved by dotfuscator and by default all the following builds will appear in this folder).
**I'm sorry that all of this is necessary but is worth it. Dotfuscator minimizes a bit the size of the executable and obfuscates the code**.
**I'm sorry that all of this is necessary but is worth it. Dotfuscator minimizes a bit the size of the executable and obfuscates the code**.
![](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)
## Colors **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:
![](https://user-images.githubusercontent.com/1741662/148418852-e7ffee6a-c270-4e26-bf38-bb8977b3ad9c.png)
![](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/raw/master/winPEAS/winPEASexe/images/colors.png) </details>
## Checks ## Checks
<details> <details>
<summary>Details</summary> <summary>Details</summary>
- **System Information** - **System Information**
- [x] Basic System info information - [x] Basic System info information
- [x] Use Watson to search for vulnerabilities - [x] Use Watson to search for vulnerabilities
- [x] Enumerate Microsoft updates - [x] Enumerate Microsoft updates
- [x] PS, Audit, WEF and LAPS Settings - [x] PS, Audit, WEF and LAPS Settings
- [x] LSA protection - [x] LSA protection
- [x] Credential Guard - [x] Credential Guard
- [x] WDigest - [x] WDigest
- [x] Number of cached cred - [x] Number of cached cred
- [x] Environment Variables - [x] Environment Variables
- [x] Internet Settings - [x] Internet Settings
- [x] Current drives information - [x] Current drives information
- [x] AV - [x] AV
- [x] Windows Defender - [x] Windows Defender
- [x] UAC configuration - [x] UAC configuration
- [x] NTLM Settings - [x] NTLM Settings
- [x] Local Group Policy - [x] Local Group Policy
- [x] Applocker Configuration & bypass suggestions - [x] Applocker Configuration & bypass suggestions
- [x] Printers - [x] Printers
- [x] Named Pipes - [x] Named Pipes
- [x] AMSI Providers - [x] AMSI Providers
- [x] SysMon - [x] SysMon
- [x] .NET Versions - [x] .NET Versions
- **Users Information** - **Users Information**
- [x] Users information - [x] Users information
- [x] Current token privileges - [x] Current token privileges
- [x] Clipboard text - [x] Clipboard text
- [x] Current logged users - [x] Current logged users
- [x] RDP sessions - [x] RDP sessions
- [x] Ever logged users - [x] Ever logged users
- [x] Autologin credentials - [x] Autologin credentials
- [x] Home folders - [x] Home folders
- [x] Password policies - [x] Password policies
- [x] Local User details - [x] Local User details
- [x] Logon Sessions - [x] Logon Sessions
- **Processes Information** - **Processes Information**
- [x] Interesting processes (non Microsoft) - [x] Interesting processes (non Microsoft)
- **Services Information** - **Services Information**
- [x] Interesting services (non Microsoft) information - [x] Interesting services (non Microsoft) information
- [x] Modifiable services - [x] Modifiable services
- [x] Writable service registry binpath - [x] Writable service registry binpath
- [x] PATH Dll Hijacking - [x] PATH Dll Hijacking
- **Applications Information** - **Applications Information**
- [x] Current Active Window - [x] Current Active Window
- [x] Installed software - [x] Installed software
- [x] AutoRuns - [x] AutoRuns
- [x] Scheduled tasks - [x] Scheduled tasks
- [x] Device drivers - [x] Device drivers
- **Network Information** - **Network Information**
- [x] Current net shares - [x] Current net shares
- [x] Mapped drives (WMI) - [x] Mapped drives (WMI)
- [x] hosts file - [x] hosts file
- [x] Network Interfaces - [x] Network Interfaces
- [x] Listening ports - [x] Listening ports
- [x] Firewall rules - [x] Firewall rules
- [x] DNS Cache (limit 70) - [x] DNS Cache (limit 70)
- [x] Internet Settings - [x] Internet Settings
- **Windows Credentials** - **Windows Credentials**
- [x] Windows Vault - [x] Windows Vault
- [x] Credential Manager - [x] Credential Manager
- [x] Saved RDP settings - [x] Saved RDP settings
- [x] Recently run commands - [x] Recently run commands
- [x] Default PS transcripts files - [x] Default PS transcripts files
- [x] DPAPI Masterkeys - [x] DPAPI Masterkeys
- [x] DPAPI Credential files - [x] DPAPI Credential files
- [x] Remote Desktop Connection Manager credentials - [x] Remote Desktop Connection Manager credentials
- [x] Kerberos Tickets - [x] Kerberos Tickets
- [x] Wifi - [x] Wifi
- [x] AppCmd.exe - [x] AppCmd.exe
- [x] SSClient.exe - [x] SSClient.exe
- [x] SCCM - [x] SCCM
- [x] Security Package Credentials - [x] Security Package Credentials
- [x] AlwaysInstallElevated - [x] AlwaysInstallElevated
- [x] WSUS - [x] WSUS
- **Browser Information** - **Browser Information**
- [x] Firefox DBs - [x] Firefox DBs
- [x] Credentials in firefox history - [x] Credentials in firefox history
- [x] Chrome DBs - [x] Chrome DBs
- [x] Credentials in chrome history - [x] Credentials in chrome history
- [x] Current IE tabs - [x] Current IE tabs
- [x] Credentials in IE history - [x] Credentials in IE history
- [x] IE Favorites - [x] IE Favorites
- [x] Extracting saved passwords for: Firefox, Chrome, Opera, Brave - [x] Extracting saved passwords for: Firefox, Chrome, Opera, Brave
- **Interesting Files and registry** - **Interesting Files and registry**
- [x] Putty sessions - [x] Putty sessions
- [x] Putty SSH host keys - [x] Putty SSH host keys
- [x] SuperPutty info - [x] SuperPutty info
- [x] Office365 endpoints synced by OneDrive - [x] Office365 endpoints synced by OneDrive
- [x] SSH Keys inside registry - [x] SSH Keys inside registry
- [x] Cloud credentials - [x] Cloud credentials
- [x] Check for unattended files - [x] Check for unattended files
- [x] Check for SAM & SYSTEM backups - [x] Check for SAM & SYSTEM backups
- [x] Check for cached GPP Passwords - [x] Check for cached GPP Passwords
- [x] Check for and extract creds from McAffe SiteList.xml files - [x] Check for and extract creds from McAffe SiteList.xml files
- [x] Possible registries with credentials - [x] Possible registries with credentials
- [x] Possible credentials files in users homes - [x] Possible credentials files in users homes
- [x] Possible password files inside the Recycle bin - [x] Possible password files inside the Recycle bin
- [x] Possible files containing credentials (this take some minutes) - [x] Possible files containing credentials (this take some minutes)
- [x] User documents (limit 100) - [x] User documents (limit 100)
- [x] Oracle SQL Developer config files check - [x] Oracle SQL Developer config files check
- [x] Slack files search - [x] Slack files search
- [x] Outlook downloads - [x] Outlook downloads
- [x] Machine and user certificate files - [x] Machine and user certificate files
- [x] Office most recent documents - [x] Office most recent documents
- [x] Hidden files and folders - [x] Hidden files and folders
- [x] Executable files in non-default folders with write permissions - [x] Executable files in non-default folders with write permissions
- [x] WSL check - [x] WSL check
- **Events Information** - **Events Information**
- [x] Logon + Explicit Logon Events - [x] Logon + Explicit Logon Events
- [x] Process Creation Events - [x] Process Creation Events
- [x] PowerShell Events - [x] PowerShell Events
- [x] Power On/Off Events - [x] Power On/Off Events
- **Additional (slower) checks** - **Additional (slower) checks**
- [x] LOLBAS search - [x] LOLBAS search
- [x] run **[linpeas.sh](https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh)** in default WSL distribution - [x] run **[linpeas.sh](https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh)** in default WSL distribution
</details> </details>
## TODO ## TODO
- Add more checks - Add more checks
- Mantain updated Watson (last JAN 2021) - Mantain updated Watson (last JAN 2021)
If you want to help with any of this, you can do it using **[github issues](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/issues)** or you can submit a pull request. If you want to help with any of this, you can do it using **[github issues](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/issues)** or you can submit a pull request.
If you find any issue, please report it using **[github issues](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/issues)**. If you find any issue, please report it using **[github issues](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/issues)**.
**WinPEAS** is being **updated** every time I find something that could be useful to escalate privileges. **WinPEAS** is being **updated** every time I find something that could be useful to escalate privileges.
## Please, if this tool has been useful for you consider to donate ## Please, if this tool has been useful for you consider to donate
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.patreon.com/peass) [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.patreon.com/peass)
## Advisory ## Advisory
All the scripts/binaries of the PEAS Suite should be used for authorized penetration testing and/or educational purposes only. Any misuse of this software will not be the responsibility of the author or of any other collaborator. Use it at your own networks and/or with the network owner's permission. All the scripts/binaries of the PEAS Suite should be used for authorized penetration testing and/or educational purposes only. Any misuse of this software will not be the responsibility of the author or of any other collaborator. Use it at your own networks and/or with the network owner's permission.
By Polop<sup>(TM)</sup>, makikvues (makikvues2[at]gmail[dot].com) By Polop<sup>(TM)</sup>, makikvues (makikvues2[at]gmail[dot].com)

View File

@@ -1,51 +1,51 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
VisualStudioVersion = 16.0.29326.143 VisualStudioVersion = 16.0.29326.143
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winPEAS", "winPEAS\winPEAS.csproj", "{D934058E-A7DB-493F-A741-AE8E3DF867F4}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winPEAS", "winPEAS\winPEAS.csproj", "{D934058E-A7DB-493F-A741-AE8E3DF867F4}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winPEAS.Tests", "Tests\winPEAS.Tests.csproj", "{66AA4619-4D0F-4226-9D96-298870E9BB50}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winPEAS.Tests", "Tests\winPEAS.Tests.csproj", "{66AA4619-4D0F-4226-9D96-298870E9BB50}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Debug|x86 = Debug|x86 Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64 Release|x64 = Release|x64
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|Any CPU.Build.0 = Debug|Any CPU {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|x64.ActiveCfg = Debug|x64 {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|x64.ActiveCfg = Debug|x64
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|x64.Build.0 = Debug|x64 {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|x64.Build.0 = Debug|x64
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|x86.ActiveCfg = Debug|x86 {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|x86.ActiveCfg = Debug|x86
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|x86.Build.0 = Debug|x86 {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Debug|x86.Build.0 = Debug|x86
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|Any CPU.ActiveCfg = Release|Any CPU {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|Any CPU.Build.0 = Release|Any CPU {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|Any CPU.Build.0 = Release|Any CPU
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x64.ActiveCfg = Release|x64 {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x64.ActiveCfg = Release|x64
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x64.Build.0 = Release|x64 {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x64.Build.0 = Release|x64
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x86.ActiveCfg = Release|x86 {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x86.ActiveCfg = Release|x86
{D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x86.Build.0 = Release|x86 {D934058E-A7DB-493F-A741-AE8E3DF867F4}.Release|x86.Build.0 = Release|x86
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|Any CPU.Build.0 = Debug|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|x64.ActiveCfg = Debug|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|x64.ActiveCfg = Debug|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|x64.Build.0 = Debug|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|x64.Build.0 = Debug|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|x86.ActiveCfg = Debug|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|x86.ActiveCfg = Debug|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|x86.Build.0 = Debug|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Debug|x86.Build.0 = Debug|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|Any CPU.ActiveCfg = Release|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|Any CPU.Build.0 = Release|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|Any CPU.Build.0 = Release|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|x64.ActiveCfg = Release|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|x64.ActiveCfg = Release|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|x64.Build.0 = Release|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|x64.Build.0 = Release|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|x86.ActiveCfg = Release|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|x86.ActiveCfg = Release|Any CPU
{66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|x86.Build.0 = Release|Any CPU {66AA4619-4D0F-4226-9D96-298870E9BB50}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D5215BC3-80A2-4E63-B560-A8F78A763B7C} SolutionGuid = {D5215BC3-80A2-4E63-B560-A8F78A763B7C}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup useLegacyV2RuntimeActivationPolicy="true"> <startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup>
</configuration> </configuration>

View File

@@ -42,7 +42,7 @@ namespace winPEAS.Checks
private static readonly HashSet<string> _systemCheckSelectedKeysHashSet = new HashSet<string>(); private static readonly HashSet<string> _systemCheckSelectedKeysHashSet = new HashSet<string>();
// github url for Linpeas.sh // github url for Linpeas.sh
public static string LinpeasUrl = "https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh"; public static string LinpeasUrl = "https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh";
public const string DefaultLogFile = "out.txt"; public const string DefaultLogFile = "out.txt";
@@ -80,7 +80,7 @@ namespace winPEAS.Checks
new SystemCheck("windowscreds", new WindowsCreds()), new SystemCheck("windowscreds", new WindowsCreds()),
new SystemCheck("browserinfo", new BrowserInfo()), new SystemCheck("browserinfo", new BrowserInfo()),
new SystemCheck("filesinfo", new FilesInfo()), new SystemCheck("filesinfo", new FilesInfo()),
new SystemCheck("fileAnalysis", new FileAnalysis()) new SystemCheck("fileanalysis", new FileAnalysis())
}; };
var systemCheckAllKeys = new HashSet<string>(_systemChecks.Select(i => i.Key)); var systemCheckAllKeys = new HashSet<string>(_systemChecks.Select(i => i.Key));

View File

@@ -53,7 +53,7 @@ namespace winPEAS.Checks
} }
files.AddRange(SearchHelper.RootDirUsers); files.AddRange(SearchHelper.RootDirUsers);
// files.AddRange(SearchHelper.RootDirCurrentUser); // not needed, it's contained within RootDirUsers // files.AddRange(SearchHelper.RootDirCurrentUser); // not needed, it's contained within RootDirUsers
files.AddRange(SearchHelper.DocumentsAndSettings); files.AddRange(SearchHelper.DocumentsAndSettings);
files.AddRange(SearchHelper.GroupPolicyHistory); // TODO maybe not needed here files.AddRange(SearchHelper.GroupPolicyHistory); // TODO maybe not needed here
files.AddRange(SearchHelper.ProgramFiles); files.AddRange(SearchHelper.ProgramFiles);
@@ -62,7 +62,7 @@ namespace winPEAS.Checks
return files; return files;
} }
private static bool Search(List<CustomFileInfo> files, string fileName, FileSettings fileSettings, ref int resultsCount) private static bool[] Search(List<CustomFileInfo> files, string fileName, FileSettings fileSettings, ref int resultsCount, string searchName, bool somethingFound)
{ {
bool isRegexSearch = fileName.Contains("*"); bool isRegexSearch = fileName.Contains("*");
string pattern = string.Empty; string pattern = string.Empty;
@@ -86,13 +86,18 @@ namespace winPEAS.Checks
if (isFileFound) if (isFileFound)
{ {
if (!somethingFound) {
Beaprint.MainPrint($"Found {searchName} Files");
somethingFound = true;
}
// there are no inner sections // there are no inner sections
if (fileSettings.files == null) if (fileSettings.files == null)
{ {
var isProcessed = ProcessResult(file, fileSettings, ref resultsCount); var isProcessed = ProcessResult(file, fileSettings, ref resultsCount);
if (!isProcessed) if (!isProcessed)
{ {
return true; return new bool[] { true, somethingFound };
} }
} }
// there are inner sections // there are inner sections
@@ -109,7 +114,7 @@ namespace winPEAS.Checks
var isProcessed = ProcessResult(innerFile, innerFileToSearch.value, ref resultsCount); var isProcessed = ProcessResult(innerFile, innerFileToSearch.value, ref resultsCount);
if (!isProcessed) if (!isProcessed)
{ {
return true; return new bool[] { true, somethingFound };
} }
} }
} }
@@ -117,7 +122,7 @@ namespace winPEAS.Checks
} }
} }
return false; return new bool[] { false, somethingFound };
} }
private static void PrintYAMLSearchFiles() private static void PrintYAMLSearchFiles()
@@ -133,15 +138,17 @@ namespace winPEAS.Checks
foreach (var searchItem in searchItems) foreach (var searchItem in searchItems)
{ {
if (searchItem.name != "Wifi Connections")
continue;
var searchName = searchItem.name; var searchName = searchItem.name;
var value = searchItem.value; var value = searchItem.value;
var searchConfig = value.config; var searchConfig = value.config;
bool somethingFound = false;
CheckRunner.Run(() => CheckRunner.Run(() =>
{ {
Beaprint.MainPrint($"Analyzing {searchName} Files (limit {ListFileLimit})");
int resultsCount = 0; int resultsCount = 0;
bool[] results;
bool isSearchFinished = false; bool isSearchFinished = false;
foreach (var file in value.files) foreach (var file in value.files)
@@ -150,7 +157,10 @@ namespace winPEAS.Checks
var fileSettings = file.value; var fileSettings = file.value;
var itemsToSearch = fileSettings.type == "f" ? files : folders; var itemsToSearch = fileSettings.type == "f" ? files : folders;
isSearchFinished = Search(itemsToSearch, fileName, fileSettings, ref resultsCount); results = Search(itemsToSearch, fileName, fileSettings, ref resultsCount, searchName, somethingFound);
isSearchFinished = results[0];
somethingFound = results[1];
if (isSearchFinished) if (isSearchFinished)
{ {
@@ -193,18 +203,22 @@ namespace winPEAS.Checks
if (fileSettings.type == "f") if (fileSettings.type == "f")
{ {
if ((bool)fileSettings.just_list_file) var colors = new Dictionary<string, string>();
{ colors.Add(fileInfo.Filename, Beaprint.ansi_color_bad);
Beaprint.BadPrint($" {fileInfo.FullPath}"); Beaprint.AnsiPrint($"File: {fileInfo.FullPath}", colors);
}
else if (!(bool)fileSettings.just_list_file)
{ {
GrepResult(fileInfo, fileSettings); GrepResult(fileInfo, fileSettings);
} }
} }
else if (fileSettings.type == "d") else if (fileSettings.type == "d")
{ {
// just list the directory var colors = new Dictionary<string, string>();
colors.Add(fileInfo.Filename, Beaprint.ansi_color_bad);
Beaprint.AnsiPrint($"Folder: {fileInfo.FullPath}", colors);
// just list the directory
if ((bool)fileSettings.just_list_file) if ((bool)fileSettings.just_list_file)
{ {
string[] files = Directory.GetFiles(fileInfo.FullPath, "*", SearchOption.TopDirectoryOnly); string[] files = Directory.GetFiles(fileInfo.FullPath, "*", SearchOption.TopDirectoryOnly);
@@ -225,8 +239,6 @@ namespace winPEAS.Checks
private static void GrepResult(CustomFileInfo fileInfo, FileSettings fileSettings) private static void GrepResult(CustomFileInfo fileInfo, FileSettings fileSettings)
{ {
Beaprint.NoColorPrint($" '{fileInfo.FullPath}' - content:");
var fileContent = File.ReadLines(fileInfo.FullPath); var fileContent = File.ReadLines(fileInfo.FullPath);
var colors = new Dictionary<string, string>(); var colors = new Dictionary<string, string>();
@@ -272,7 +284,8 @@ namespace winPEAS.Checks
Beaprint.AnsiPrint(content, colors); Beaprint.AnsiPrint(content, colors);
Console.WriteLine(); if (content.Length > 0)
Console.WriteLine();
} }
private static string SanitizeLineGrep(string lineGrep) private static string SanitizeLineGrep(string lineGrep)
@@ -281,7 +294,16 @@ namespace winPEAS.Checks
// '-i -a -o "description.*" | sort | uniq' // '-i -a -o "description.*" | sort | uniq'
// - remove everything except from "description.*" // - remove everything except from "description.*"
Regex regex = new Regex("\"([^\"]+)\""); Regex regex;
if (lineGrep.Contains("-i"))
{
regex = new Regex("\"([^\"]+)\"", RegexOptions.IgnoreCase);
}
else
{
regex = new Regex("\"([^\"]+)\"");
}
Match match = regex.Match(lineGrep); Match match = regex.Match(lineGrep);
if (match.Success) if (match.Success)

View File

@@ -1,3 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura /> <Costura />
</Weavers> </Weavers>

View File

@@ -1,111 +1,111 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> <!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers"> <xs:element name="Weavers">
<xs:complexType> <xs:complexType>
<xs:all> <xs:all>
<xs:element name="Costura" minOccurs="0" maxOccurs="1"> <xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType> <xs:complexType>
<xs:all> <xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string"> <xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation> <xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:element> </xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string"> <xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation> <xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:element> </xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string"> <xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation> <xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:element> </xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string"> <xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation> <xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:element> </xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string"> <xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation> <xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:element> </xs:element>
</xs:all> </xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean"> <xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation> <xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean"> <xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation> <xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean"> <xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation> <xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean"> <xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation> <xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean"> <xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation> <xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean"> <xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation> <xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string"> <xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation> <xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string"> <xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation> <xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string"> <xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation> <xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string"> <xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation> <xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string"> <xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation> <xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:all> </xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean"> <xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> <xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> <xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> <xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean"> <xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation> <xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> <xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation> </xs:annotation>
</xs:attribute> </xs:attribute>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:schema> </xs:schema>

View File

@@ -44,32 +44,31 @@ namespace winPEAS.Helpers
public static void PrintBanner() public static void PrintBanner()
{ {
Console.WriteLine(BLUE + string.Format(@" Console.WriteLine(BLUE + string.Format(@"
{0}*((,.,/((((((((((((((((((((/, */ {0}((((((((((((((((((((((((((((((((
{0},/*,..*((((((((((((((((((((((((((((((((((, {0}(((((((((((((((((((((((((((((((((((((((((((
{0},*/((((((((((((((((((/, .*//((//**, .*(((((((* {0}(((((((((((((({2}**********/{1}##########{0}.((((((((((((
{0}(((((((((((((((({2}**********/{1}########## {0}.(* ,((((((( {0}(((((((((((/{2}********************/{1}#######{0}.((((((((((
{0}(((((((((((/{2}********************/{1}####### {0}.(. ((((((( {0}(((((((.{2}******************{3}/@@@@@/{0}{2}****{1}######{0}.(((((((((
{0}((((((..{2}******************{3}/@@@@@/{2}***/{1}###### {0}./((((((( {0}(((((.{2}********************{3}@@@@@@@@@@/{0}{2}***,{1}####{0}.(((((((((
{0},,....{2}********************{3}@@@@@@@@@@{2}(***,{1}#### {0}.//(((((( {0}((((.{2}********************{3}/@@@@@%@@@@{0}{2}/********{1}##{0}(((((((((
{0}, ,..{2}********************{3}/@@@@@%@@@@{2}/********{1}##{0}((/ /(((( {0}.(({1}############{2}*********{3}/%@@@@@@@@@{0}{2}/************{0}.(((((((
{0}..(({1}###########{2}*********{3}/%@@@@@@@@@{2}/************{0},,..(((( {0}.({1}##################(/{2}******{3}/@@@@@{0}{2}/***************{0}.(((((
{0}.({1}##################(/{2}******{3}/@@@@@{2}/***************{0}.. /(( {0}.({1}#########################(/{2}**********************{0}.((((
{0}.({1}#########################(/{2}**********************{0}..*(( {0}.({1}##############################(/{2}*****************{0}.((((
{0}.({1}##############################(/{2}*****************{0}.,((( {0}.({1}###################################(/{2}************{0}.((((
{0}.({1}###################################(/{2}************{0}..((( {0}.({1}#######################################({2}*********{0}.((((
{0}.({1}#######################################({2}*********{0}..((( {0}.({1}#######(,.***.,(###################(..***.{2}*******{0}.((((
{0}.({1}#######(,.***.,(###################(..***.{2}*******{0}..((( {0}.({1}#######*(#####((##################((######/({2}*****{0}.((((
{0}.({1}#######*(#####((##################((######/({2}*****{0}..((( {0}.({1}###################(/***********(##############({0}).((((
{0}.({1}###################(/***********(##############({0}...((( {0}.(({1}#####################/*******(################{0})((((((
{0}.(({1}#####################/*******(################{0}.(((((( {0}.((({1}############################################{0}).(((((
{0}.((({1}############################################{0}(..(((( {0}..((({1}##########################################{0}).((((((
{0}..((({1}##########################################{0}(..((((( {0}....(({1}########################################{0}).((((((
{0}....(({1}########################################{0}( .((((( {0}......(({1}####################################{0}).(((((((
{0}......(({1}####################################{0}( .(((((( {0}((((((((({1}#################################{0}).((((((((
{0}((((((((({1}#################################{0}(../(((((( {0}(((((((((/{1}##########################{0}).((((((((
{0}(((((((((/{1}##########################{0}(/..(((((( {0}((((((((((((((((((((((((((((((((((((((
{0}(((((((((/,. ,*//////*,. ./(((((((((((((((. {0}((((((((((((((((((((((((((((((", LGREEN, GREEN, BLUE, NOCOLOR) + NOCOLOR);
{0}(((((((((((((((((((((((((((((/", LGREEN, GREEN, BLUE, NOCOLOR) + NOCOLOR);
Console.WriteLine(); Console.WriteLine();
Console.WriteLine(LYELLOW + "ADVISORY: " + BLUE + Advisory); Console.WriteLine(LYELLOW + "ADVISORY: " + BLUE + Advisory);
@@ -136,7 +135,8 @@ namespace winPEAS.Helpers
Console.WriteLine(LBLUE + " networkinfo" + GRAY + " Search network information" + NOCOLOR); Console.WriteLine(LBLUE + " networkinfo" + GRAY + " Search network information" + NOCOLOR);
Console.WriteLine(LBLUE + " windowscreds" + GRAY + " Search windows credentials" + NOCOLOR); Console.WriteLine(LBLUE + " windowscreds" + GRAY + " Search windows credentials" + NOCOLOR);
Console.WriteLine(LBLUE + " browserinfo" + GRAY + " Search browser information" + NOCOLOR); Console.WriteLine(LBLUE + " browserinfo" + GRAY + " Search browser information" + NOCOLOR);
Console.WriteLine(LBLUE + " filesinfo" + GRAY + " Search files that can contains credentials" + NOCOLOR); Console.WriteLine(LBLUE + " filesinfo" + GRAY + " Search generic files that can contains credentials" + NOCOLOR);
Console.WriteLine(LBLUE + " fileanalysis" + GRAY + " Search specific files that can contains credentials" + NOCOLOR);
Console.WriteLine(LBLUE + " eventsinfo" + GRAY + " Display interesting events information" + NOCOLOR); Console.WriteLine(LBLUE + " eventsinfo" + GRAY + " Display interesting events information" + NOCOLOR);
Console.WriteLine(LBLUE + " wait" + GRAY + " Wait for user input between checks" + NOCOLOR); Console.WriteLine(LBLUE + " wait" + GRAY + " Wait for user input between checks" + NOCOLOR);
Console.WriteLine(LBLUE + " debug" + GRAY + " Display debugging information - memory usage, method execution time" + NOCOLOR); Console.WriteLine(LBLUE + " debug" + GRAY + " Display debugging information - memory usage, method execution time" + NOCOLOR);

View File

@@ -25,6 +25,7 @@ namespace winPEAS.Helpers.Search
ConcurrentBag<CustomFileInfo> files = new ConcurrentBag<CustomFileInfo>(); ConcurrentBag<CustomFileInfo> files = new ConcurrentBag<CustomFileInfo>();
IEnumerable<DirectoryInfo> startDirs = GetStartDirectories(folder, files, pattern, isFoldersIncluded); IEnumerable<DirectoryInfo> startDirs = GetStartDirectories(folder, files, pattern, isFoldersIncluded);
IList<DirectoryInfo> startDirsExcluded = new List<DirectoryInfo>(); IList<DirectoryInfo> startDirsExcluded = new List<DirectoryInfo>();
IList<string> known_dirs = new List<string>();
if (excludedDirs != null) if (excludedDirs != null)
{ {
@@ -51,9 +52,18 @@ namespace winPEAS.Helpers.Search
Parallel.ForEach(GetStartDirectories(d.FullName, files, pattern, isFoldersIncluded), (dir) => Parallel.ForEach(GetStartDirectories(d.FullName, files, pattern, isFoldersIncluded), (dir) =>
{ {
GetFiles(dir.FullName, pattern).ForEach( GetFiles(dir.FullName, pattern).ForEach(
(f) => (f) => {
files.Add(new CustomFileInfo(f.Name, f.Extension, f.FullName, false)) CustomFileInfo file_info = new CustomFileInfo(f.Name, f.Extension, f.FullName, false);
); files.Add(file_info);
CustomFileInfo file_dir = new CustomFileInfo(f.Directory.Name, "", f.Directory.FullName, true);
if (!known_dirs.Contains(file_dir.FullPath))
{
known_dirs.Add(file_dir.FullPath);
files.Add(file_dir);
}
}
) ;
}); });
}); });
@@ -175,29 +185,28 @@ namespace winPEAS.Helpers.Search
// c:\users\current_user // c:\users\current_user
string rootCurrentUserSearchPath = Environment.GetEnvironmentVariable("USERPROFILE"); string rootCurrentUserSearchPath = Environment.GetEnvironmentVariable("USERPROFILE");
SearchHelper.RootDirCurrentUser = SearchHelper.GetFilesFast(rootCurrentUserSearchPath, GlobalPattern); SearchHelper.RootDirCurrentUser = SearchHelper.GetFilesFast(rootCurrentUserSearchPath, GlobalPattern, isFoldersIncluded: true);
// c:\Program Files\ // c:\Program Files\
string rootProgramFiles = $"{SystemDrive}\\Program Files\\"; string rootProgramFiles = $"{SystemDrive}\\Program Files\\";
SearchHelper.ProgramFiles = SearchHelper.GetFilesFast(rootProgramFiles, GlobalPattern); SearchHelper.ProgramFiles = SearchHelper.GetFilesFast(rootProgramFiles, GlobalPattern, isFoldersIncluded: true);
// c:\Program Files (x86)\ // c:\Program Files (x86)\
string rootProgramFilesX86 = $"{SystemDrive}\\Program Files (x86)\\"; string rootProgramFilesX86 = $"{SystemDrive}\\Program Files (x86)\\";
SearchHelper.ProgramFilesX86 = SearchHelper.GetFilesFast(rootProgramFilesX86, GlobalPattern); SearchHelper.ProgramFilesX86 = SearchHelper.GetFilesFast(rootProgramFilesX86, GlobalPattern, isFoldersIncluded: true);
// c:\Documents and Settings\ // c:\Documents and Settings\
string documentsAndSettings = $"{SystemDrive}\\Documents and Settings\\"; string documentsAndSettings = $"{SystemDrive}\\Documents and Settings\\";
SearchHelper.DocumentsAndSettings = SearchHelper.GetFilesFast(documentsAndSettings, GlobalPattern); SearchHelper.DocumentsAndSettings = SearchHelper.GetFilesFast(documentsAndSettings, GlobalPattern, isFoldersIncluded: true);
// c:\ProgramData\Microsoft\Group Policy\History // c:\ProgramData\Microsoft\Group Policy\History
string groupPolicyHistory = $"{SystemDrive}\\ProgramData\\Microsoft\\Group Policy\\History"; string groupPolicyHistory = $"{SystemDrive}\\ProgramData\\Microsoft\\Group Policy\\History";
SearchHelper.GroupPolicyHistory = SearchHelper.GetFilesFast(groupPolicyHistory, GlobalPattern); SearchHelper.GroupPolicyHistory = SearchHelper.GetFilesFast(groupPolicyHistory, GlobalPattern, isFoldersIncluded: true);
// c:\Documents and Settings\All Users\Application Data\\Microsoft\\Group Policy\\History // c:\Documents and Settings\All Users\Application Data\\Microsoft\\Group Policy\\History
string groupPolicyHistoryLegacy = $"{documentsAndSettings}\\All Users\\Application Data\\Microsoft\\Group Policy\\History"; string groupPolicyHistoryLegacy = $"{documentsAndSettings}\\All Users\\Application Data\\Microsoft\\Group Policy\\History";
//SearchHelper.GroupPolicyHistoryLegacy = SearchHelper.GetFilesFast(groupPolicyHistoryLegacy, globalPattern); //SearchHelper.GroupPolicyHistoryLegacy = SearchHelper.GetFilesFast(groupPolicyHistoryLegacy, globalPattern);
var groupPolicyHistoryLegacyFiles = SearchHelper.GetFilesFast(groupPolicyHistoryLegacy, GlobalPattern); var groupPolicyHistoryLegacyFiles = SearchHelper.GetFilesFast(groupPolicyHistoryLegacy, GlobalPattern, isFoldersIncluded: true);
SearchHelper.GroupPolicyHistory.AddRange(groupPolicyHistoryLegacyFiles); SearchHelper.GroupPolicyHistory.AddRange(groupPolicyHistoryLegacyFiles);
} }

View File

@@ -217,11 +217,15 @@ namespace winPEAS.Info.ServicesInfo
{ {
if (SIDs.ContainsKey(ace.SecurityIdentifier.ToString())) if (SIDs.ContainsKey(ace.SecurityIdentifier.ToString()))
{ {
int serviceRights = ace.AccessMask; string aceType = ace.AceType.ToString();
if (!(aceType.Contains("Denied")))
string current_perm_str = PermissionsHelper.PermInt2Str(serviceRights, PermissionType.WRITEABLE_OR_EQUIVALENT_SVC); { //https://docs.microsoft.com/en-us/dotnet/api/system.security.accesscontrol.commonace?view=net-6.0
if (!string.IsNullOrEmpty(current_perm_str) && !permissions.Contains(current_perm_str)) int serviceRights = ace.AccessMask;
permissions.Add(current_perm_str); string current_perm_str = PermissionsHelper.PermInt2Str(serviceRights, PermissionType.WRITEABLE_OR_EQUIVALENT_SVC);
if (!string.IsNullOrEmpty(current_perm_str) && !permissions.Contains(current_perm_str))
permissions.Add(current_perm_str);
}
} }
} }

View File

@@ -1,17 +1,17 @@
using System; using System;
namespace winPEAS namespace winPEAS
{ {
public static class Program public static class Program
{ {
// Static blacklists // Static blacklists
//static string goodSoft = "Windows Phone Kits|Windows Kits|Windows Defender|Windows Mail|Windows Media Player|Windows Multimedia Platform|windows nt|Windows Photo Viewer|Windows Portable Devices|Windows Security|Windows Sidebar|WindowsApps|WindowsPowerShell| Windows$|Microsoft|WOW6432Node|internet explorer|Internet Explorer|Common Files"; //static string goodSoft = "Windows Phone Kits|Windows Kits|Windows Defender|Windows Mail|Windows Media Player|Windows Multimedia Platform|windows nt|Windows Photo Viewer|Windows Portable Devices|Windows Security|Windows Sidebar|WindowsApps|WindowsPowerShell| Windows$|Microsoft|WOW6432Node|internet explorer|Internet Explorer|Common Files";
[STAThread] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
Checks.Checks.Run(args); Checks.Checks.Run(args);
} }
} }
} }

View File

@@ -1,36 +1,36 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("asdas2dasd")] [assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("asdas2dasd")] [assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1928358e-a64b-493f-a741-ae8e3d029374")] [assembly: Guid("1928358e-a64b-493f-a741-ae8e3d029374")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +1,34 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<StartArguments> <StartArguments>
</StartArguments> </StartArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>servicesinfo</StartArguments> <StartArguments>fileAnalysis</StartArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<StartArguments>debug</StartArguments> <StartArguments>debug</StartArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<StartArguments>fast</StartArguments> <StartArguments>fast</StartArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<StartArguments> <StartArguments>
</StartArguments> </StartArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<StartArguments> <StartArguments>
</StartArguments> </StartArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project> </Project>