Compare commits

...

23 Commits

Author SHA1 Message Date
Carlos Polop
91805d7542 Update CI-master_tests.yml 2022-03-17 10:58:17 +00:00
Carlos Polop
9ea0c01b82 Merge pull request #282 from carlospolop/linpeas_dev
check /opt
2022-03-15 00:11:28 +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
16 changed files with 395 additions and 141 deletions

View File

@@ -285,8 +285,8 @@ jobs:
run: linPEAS/linpeas.sh -h run: linPEAS/linpeas.sh -h
# 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:

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)
@@ -317,6 +319,24 @@ search:
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:
config: config:
@@ -383,14 +403,16 @@ 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"
@@ -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,32 +772,74 @@ 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:
- name: "kubelet"
value:
files: files:
- name: "kubeconfig" - name: "kubeconfig"
value: value:
bad_regex: "server:|cluster:|namespace:|user:|exec:" bad_regex: "server:|cluster:|namespace:|user:|exec:"
type: d 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"
value:
files:
- name: "kubelet.conf"
value:
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
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:
config: config:
@@ -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:
@@ -1516,6 +1624,37 @@ search:
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:
disable: disable:
@@ -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

@@ -24,12 +24,24 @@ echo ""
#-- SY) CVE-2021-4034 #-- SY) CVE-2021-4034
if [ `command -v pkexec` ] && stat -c '%a' $(which pkexec) | grep -q 4755 && [ "$(stat -c '%Y' $(which pkexec))" -lt "1642035600" ]; then 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 "Vulnerable to CVE-2021-4034" | sed -${E} "s,.*,${SED_RED_YELLOW},"
echo ""
fi fi
#-- SY) CVE-2021-3560 #-- SY) CVE-2021-3560
polkitVersion=$(systemctl status polkit.service | grep version | cut -d " " -f 9) polkitVersion=$(systemctl status polkit.service | grep version | cut -d " " -f 9)
if [[ "$(apt list --installed 2>/dev/null | grep polkit | grep -c 0.105-26)" -ge 1 || "$(yum list installed | grep polkit | grep -c 0.117-2)" ]]; then 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 "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 fi
#--SY) USBCreator #--SY) USBCreator
@@ -88,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
@@ -108,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
@@ -136,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

@@ -68,7 +68,7 @@ fi
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},"

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
if [ -f "$d" ]; then
STRINGS="`command -v strings`"
echo "Potential file containing credentials:"
ls -l "$d"
if [ "$STRINGS" ]; then
strings "$d"
else
echo "Strings not found, cat the file and check it to get the creds"
fi
else
for f in $(find $d -name debian.cnf 2>/dev/null); do for f in $(find $d -name debian.cnf 2>/dev/null); do
if [ -r "$f" ]; then if [ -r "$f" ]; then
echo "We can read the mysql debian.cnf. You can use this username/password to log in MySQL" | sed -${E} "s,.*,${SED_RED}," echo "We can read the mysql debian.cnf. You can use this username/password to log in MySQL" | sed -${E} "s,.*,${SED_RED},"
cat "$f" cat "$f"
fi fi
done done
for f in $(find $d -name user.MYD 2>/dev/null); do for f in $(find $d -name user.MYD 2>/dev/null); do
if [ -r "$f" ]; then if [ -r "$f" ]; then
echo "We can read the Mysql Hashes from $f" | sed -${E} "s,.*,${SED_RED}," echo "We can read the Mysql Hashes from $f" | sed -${E} "s,.*,${SED_RED},"
grep -oaE "[-_\.\*a-Z0-9]{3,}" $f | grep -v "mysql_native_password" grep -oaE "[-_\.\*a-Z0-9]{3,}" "$f" | grep -v "mysql_native_password"
fi fi
done done
for f in $(grep -lr "user\s*=" $d 2>/dev/null | grep -v "debian.cnf"); do for f in $(grep -lr "user\s*=" $d 2>/dev/null | grep -v "debian.cnf"); do
if [ -r "$f" ]; then if [ -r "$f" ]; then
u=$(cat "$f" | grep -v "#" | grep "user" | grep "=" 2>/dev/null) 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}," 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 fi
done done
for f in $(find $d -name my.cnf 2>/dev/null); do for f in $(find $d -name my.cnf 2>/dev/null); do
if [ -r "$f" ]; then if [ -r "$f" ]; then
echo "Found readable $f" echo "Found readable $f"
grep -v "^#" "$f" | grep -Ev "\W+\#|^#" 2>/dev/null | grep -Iv "^$" | sed "s,password.*,${SED_RED}," grep -v "^#" "$f" | grep -Ev "\W+\#|^#" 2>/dev/null | grep -Iv "^$" | sed "s,password.*,${SED_RED},"
fi fi
done 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

@@ -145,7 +145,7 @@ def parse_line(line: str):
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

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

@@ -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,17 +203,21 @@ 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")
{ {
var colors = new Dictionary<string, string>();
colors.Add(fileInfo.Filename, Beaprint.ansi_color_bad);
Beaprint.AnsiPrint($"Folder: {fileInfo.FullPath}", colors);
// just list the directory // just list the directory
if ((bool)fileSettings.just_list_file) if ((bool)fileSettings.just_list_file)
{ {
@@ -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,6 +284,7 @@ namespace winPEAS.Checks
Beaprint.AnsiPrint(content, colors); Beaprint.AnsiPrint(content, colors);
if (content.Length > 0)
Console.WriteLine(); Console.WriteLine();
} }
@@ -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

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

View File

@@ -5,12 +5,12 @@ 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("")]

View File

@@ -14,6 +14,21 @@
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@@ -95,7 +110,8 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject>winPEAS.Program</StartupObject> <StartupObject>
</StartupObject>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@@ -692,5 +708,17 @@
<EmbeddedResource Include="Properties\Resources.ru.resx" /> <EmbeddedResource Include="Properties\Resources.ru.resx" />
<EmbeddedResource Include="Properties\Resources.zh-CN.resx" /> <EmbeddedResource Include="Properties\Resources.zh-CN.resx" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@@ -5,7 +5,7 @@
</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>
@@ -21,4 +21,14 @@
<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>