mirror of
https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite.git
synced 2025-12-06 17:11:29 +00:00
Compare commits
8 Commits
20250525-7
...
codex/fix-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e556fd594 | ||
|
|
c3a93a57fe | ||
|
|
f62d9fc550 | ||
|
|
11e9b8dde6 | ||
|
|
b9a9ad5ddf | ||
|
|
88f08a405e | ||
|
|
322792c4ec | ||
|
|
c150e63b52 |
@@ -26,7 +26,7 @@
|
|||||||
# License: GNU GPL
|
# License: GNU GPL
|
||||||
# Version: 1.0
|
# Version: 1.0
|
||||||
# Functions Used: echo_not_found, print_2title, print_info
|
# Functions Used: echo_not_found, print_2title, print_info
|
||||||
# Global Variables:
|
# Global Variables: $NoEnvVars, $EnvVarsRed
|
||||||
# Initial Functions:
|
# Initial Functions:
|
||||||
# Generated Global Variables:
|
# Generated Global Variables:
|
||||||
# Fat linpeas: 0
|
# Fat linpeas: 0
|
||||||
@@ -35,5 +35,5 @@
|
|||||||
|
|
||||||
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=|LS_COLORS=|pathshG=|notBackup=|processesDump|processesB|commonrootdirs|USEFUL_SOFTWARE|PSTORAGE_" | sed -${E} "s,[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 -Eiv "$NoEnvVars" | sed -${E} "s,$EnvVarsRed,${SED_RED},g" || echo_not_found "env || set"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# Title: Interesting Files - Interesting Environment Variables
|
||||||
|
# ID: IF_Interesting_environment_variables
|
||||||
|
# Author: Jack Vaughn
|
||||||
|
# Last Update: 25-05-2025
|
||||||
|
# Description: Searching possible sensitive environment variables inside of /proc/*/environ
|
||||||
|
# License: GNU GPL
|
||||||
|
# Version: 1.0
|
||||||
|
# Functions Used: print_2title
|
||||||
|
# Global Variables: $MACPEAS, $NoEnvVars, $EnvVarsRed
|
||||||
|
# Initial Functions:
|
||||||
|
# Generated Global Variables:
|
||||||
|
# Fat linpeas: 0
|
||||||
|
# Small linpeas: 1
|
||||||
|
|
||||||
|
if [ -z "$MACPEAS" ]; then
|
||||||
|
print_2title "Checking all env variables in /proc/*/environ removing duplicates and filtering out useless env vars"
|
||||||
|
cat /proc/[0-9]*/environ 2>/dev/null | \
|
||||||
|
tr '\0' '\n' | \
|
||||||
|
grep -Eiv "$NoEnvVars" | \
|
||||||
|
sort -u | \
|
||||||
|
sed -${E} "s,$EnvVarsRed,${SED_RED},g"
|
||||||
|
fi
|
||||||
18
linPEAS/builder/linpeas_parts/variables/EnvVarsRed.sh
Normal file
18
linPEAS/builder/linpeas_parts/variables/EnvVarsRed.sh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Title: Variables - EnvVarsRed
|
||||||
|
# ID: EnvVarsRed
|
||||||
|
# Author: Carlos Polop
|
||||||
|
# Last Update: 26-05-2025
|
||||||
|
# Description: Useless env vars
|
||||||
|
# License: GNU GPL
|
||||||
|
# Version: 1.0
|
||||||
|
# Functions Used:
|
||||||
|
# Global Variables:
|
||||||
|
# Initial Functions:
|
||||||
|
# Generated Global Variables: $EnvVarsRed
|
||||||
|
# Fat linpeas: 0
|
||||||
|
# Small linpeas: 1
|
||||||
|
|
||||||
|
|
||||||
|
EnvVarsRed="[pP][aA][sS][sS][wW]|[aA][pP][iI][kK][eE][yY]|[aA][pP][iI][_][kK][eE][yY]|KRB5CCNAME|[aA][pP][iI][_][kK][eE][yY]|[aA][wW][sS]|[aA][zZ][uU][rR][eE]|[gG][cC][pP]|[aA][pP][iI]|[sS][eE][cC][rR][eE][tT]|[sS][qQ][lL]|[dD][aA][tT][aA][bB][aA][sS][eE]|[tT][oO][kK][eE][nN]"
|
||||||
|
|
||||||
|
|
||||||
16
linPEAS/builder/linpeas_parts/variables/NoEnvVars.sh
Normal file
16
linPEAS/builder/linpeas_parts/variables/NoEnvVars.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Title: Variables - NoEnvVars
|
||||||
|
# ID: NoEnvVars
|
||||||
|
# Author: Carlos Polop
|
||||||
|
# Last Update: 26-05-2025
|
||||||
|
# Description: Useless env vars
|
||||||
|
# License: GNU GPL
|
||||||
|
# Version: 1.0
|
||||||
|
# Functions Used:
|
||||||
|
# Global Variables:
|
||||||
|
# Initial Functions:
|
||||||
|
# Generated Global Variables: $NoEnvVars
|
||||||
|
# Fat linpeas: 0
|
||||||
|
# Small linpeas: 1
|
||||||
|
|
||||||
|
|
||||||
|
NoEnvVars="LESS_TERMCAP|JOURNAL_STREAM|XDG_SESSION|DBUS_SESSION|systemd\/sessions|systemd_exec|MEMORY_PRESSURE_WATCH|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=|LS_COLORS=|pathshG=|notBackup=|processesDump|processesB|commonrootdirs|USEFUL_SOFTWARE|PSTORAGE_|^PATH=|^INVOCATION_ID=|^WATCHDOG_PID=|^LISTEN_PID="
|
||||||
@@ -97,7 +97,7 @@ class LinpeasBuilder:
|
|||||||
for orig_url in urls:
|
for orig_url in urls:
|
||||||
tar_gz_bin_name = ""
|
tar_gz_bin_name = ""
|
||||||
if ",,," in orig_url:
|
if ",,," in orig_url:
|
||||||
tar_gz_bin_name = url.split(",,,")[1]
|
tar_gz_bin_name = orig_url.split(",,,")[1]
|
||||||
url = orig_url.split(",,,")[0]
|
url = orig_url.split(",,,")[0]
|
||||||
else:
|
else:
|
||||||
url = orig_url
|
url = orig_url
|
||||||
|
|||||||
@@ -195,11 +195,11 @@ namespace winPEAS.Info.ProcessInfo
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
List<string> permsFile = PermissionsHelper.GetPermissionsFile(sFilePath, Checks.Checks.CurrentUserSiDs, PermissionType.WRITEABLE_OR_EQUIVALENT);
|
List<string> permsFile = PermissionsHelper.GetPermissionsFile(sFilePath, Checks.Checks.CurrentUserSiDs, PermissionType.WRITEABLE_OR_EQUIVALENT);
|
||||||
|
IdentityReference sid = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
System.Security.AccessControl.FileSecurity fs = System.IO.File.GetAccessControl(sFilePath);
|
System.Security.AccessControl.FileSecurity fs = System.IO.File.GetAccessControl(sFilePath);
|
||||||
IdentityReference sid = fs.GetOwner(typeof(SecurityIdentifier));
|
sid = fs.GetOwner(typeof(SecurityIdentifier));
|
||||||
string ownerName = sid.Translate(typeof(NTAccount)).ToString();
|
|
||||||
|
|
||||||
// If current user already have permissions over that file or the proc belongs to the owner of the file,
|
// If current user already have permissions over that file or the proc belongs to the owner of the file,
|
||||||
// handler not interesting to elevate privs
|
// handler not interesting to elevate privs
|
||||||
@@ -207,6 +207,8 @@ namespace winPEAS.Info.ProcessInfo
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
to_add["File Path"] = sFilePath;
|
to_add["File Path"] = sFilePath;
|
||||||
|
|
||||||
|
string ownerName = sid.Translate(typeof(NTAccount)).ToString();
|
||||||
to_add["File Owner"] = ownerName;
|
to_add["File Owner"] = ownerName;
|
||||||
}
|
}
|
||||||
catch (System.IO.FileNotFoundException)
|
catch (System.IO.FileNotFoundException)
|
||||||
@@ -218,7 +220,10 @@ namespace winPEAS.Info.ProcessInfo
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
catch (System.Security.Principal.IdentityNotMappedException)
|
||||||
|
{
|
||||||
|
to_add["File Owner"] = sid.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (typeName == "key")
|
else if (typeName == "key")
|
||||||
|
|||||||
Reference in New Issue
Block a user