Code Monkey home page Code Monkey logo

unix-privesc-check's People

Contributors

bdamele avatar

unix-privesc-check's Issues

Add support to verify sticky bit

Add support to verify sticky bit on world-writable directories (UPC003)

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 8:50

Fix printf format string for sudoers

The first argument to printf is often passed directly from the sudoers file. 
This can cause problems because this file commonly contains % characters for 
group definitions. This is noted in the comment in lib/misc/sudo: "# FIXME this 
printf fails when the an entry starts with percentage character (%) which is 
common for sudoers group".

Fixed this by using a simple format string, "%s", as the first argument. In the 
particular case after the comment I also added a new line to the string to fix 
a bug which leaves the final sudoers entry unprocessed.

Similar fixes should be done throughout the code base, but I just targeted code 
affected by the sudoers file here (privileged_writable really).


Original issue reported on code.google.com by [email protected] on 24 Feb 2015 at 4:20

Attachments:

Rename binary_* checks to privileged_*

It makes sense as those security checks act upon output of privileged_list 
which in time might not only return binary files

Original issue reported on code.google.com by bernardo.damele on 20 Oct 2012 at 11:50

Fix binary regex syntax errors

I'm receiving syntax errors in some of the checks which use 
`binary_matches_string_grep`. For example, running a check from 
lib/checks/privileged_arguments manually:

 sh-4.3$ y="`binary_matches_string_grep \"/tmp/foo\" \"\$[\{]*[[:digit:]][\}]*\"`"
 sh: \{: syntax error: operand expected (error token is "\{")

Patch attached.

It seems to me that the privileged_environment_variables check will alert for 
any script using $-style variables, not necessarily environment variables. So, 
I'm a bit concerned as to how noisy it will be.

Original issue reported on code.google.com by [email protected] on 2 Mar 2015 at 11:53

Attachments:

Add Samba library and security check

Add Samba library and security check (e.g. check permissions on AD file)

Original issue reported on code.google.com by bernardo.damele on 5 Nov 2012 at 3:35

Add security check for home directories

Add security check to verify the following:
* Identify and check for execute and write permissions over all users' home 
directories.
* Identify sensitive files in home directories (.exrc .netrc .rhosts .shosts 
.my.cnf .ssh/authorized_keys .*_history .forward .plan etc) and their 
permissions

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 12:46

Improve logic of privileged_writable

I believe there are a couple of deficiencies in the current implementation of 
the privileged_writable check:

1. I think files writable by a low privileged owner should always be a warning, 
not just if YOU are the current owner. If I'm running the tool as the root user 
for auditing purposes then I want to know if a standard user owns a script 
they're permitted to run as root via sudo.

2. Furthermore, if a low privileged user owns a privileged file then it should 
be reported no matter what the current permissions are. This is because the 
owner can just set it to writable if necessary.

3. Similarly to (1), if an untrusted group can write to a privileged file then 
it should be a warning even if the current user isn't a member of the group.

The attached patch will make these changes. In it's current form it only trusts 
the user with ID zero and the main group of the user with ID zero. Hopefully 
this can be improved with configurable trusts in future, see #20.

I also modified some user and group utilities to support the changes:

* Implemented the group_is_root() function by checking against `id -g -n 0`
* Switched user_is_root() and user_is_user_root() to match other 
user_is_user_*() functions which check the current user rather than a supplied 
user.
* Implemented user_is_root()

Original issue reported on code.google.com by [email protected] on 25 Feb 2015 at 1:30

Attachments:

Add privileged_* security checks to assess scripts

Add privileged_* security checks to assess scripts:
* Check for straight OS command injections
* Check for race condition bugs (e.g. symlink attack)
* ...

Original issue reported on code.google.com by bernardo.damele on 1 Nov 2012 at 1:07

Add switch to suppress empty groups stdout

Need option to suppress stdout for empty groups. Why?  pentesters+auditors 
might not care on existing servers (not exploitable). However, if auditing a 
base-build where future group members aren't clear yet, the auditor WILL care. 
Hence we need group-write for empty groups to be suppressable.

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 9:07

Add support for trusted users and groups

We need a list of trusted users and groups. We could use this list to avoid 
reporting write access that the user does not care about.
On Linux root user would be trusted. Root group too probably if it had no 
members.
On AIX the user may consider the bin user to be trusted.

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 9:11

Add security check for configuration files

Add security check to verify write permissions over configuration files in /etc

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 12:44

Add more system_* checks

Add more system_* checks:
* GrSecurity
* Heap hardening
* GCC stack protector
* Strict user copy checks
* Read-only kernel data
* Restricted /dev/mem
* Restricted /dev/kmem

Original issue reported on code.google.com by bernardo.damele on 1 Nov 2012 at 1:09

Add library and check for /etc/fstab

Add library and check for /etc/fstab (e.g. allowing users to mount file systems)

Original issue reported on code.google.com by bernardo.damele on 29 Oct 2012 at 11:40

Better handling of 2>

Files that go missing during find e.g. /proc/<n> cause find to generate an 
error.

It would be nice to handle the output more cleanly.

Original issue reported on code.google.com by [email protected] on 11 Sep 2012 at 9:38

Add --verbose switch

Add --verbose switch

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 9:05

world_can_read () check for writeable bit and not for readable bit

Download unix-privsec-check version 1.4 and open the file with an editor.
Go to the line 498. 
-----------------------
world_can_read () {
    O_MESSAGE_STACK=$1
    O_FILE=$2

    P=`ls -lLd $O_FILE | cut -c 8`

    if [ "$P" = "w" ]; then
        echo "WARNING: $O_MESSAGE_STACK World read is set for $O_FILE"
    fi
}
------------
The world_can_read function check for the bit 'w' and not the bit 'r'. 
This is wrong, because in this function we are checking for world readable and 
not world writeable files or directories. 

Regards, 
R.
--
Roberto Martelloni \ boos
http://boos.core-dumped.info

Original issue reported on code.google.com by [email protected] on 21 Mar 2014 at 10:27

Files readble by "others" are not checked correctly.

What steps will reproduce the problem?
1. chmod o+r /etc/shadow
2. run unix-privesc-check

Expect warning but nothing is noticed by tool but only following output I get:
############################################
Checking if /etc/shadow is readable
############################################
    Checking if anyone except root can read file /etc/shadow


unix-privesc-check 1.4
CentOS 5.10

Original issue reported on code.google.com by [email protected] on 12 Dec 2013 at 12:29

Inspect users PATH variable

Inspect users PATH variable: read from /proc/<pid>/environ, ~/.bashrc, 
/etc/profile, .bash_profile

Original issue reported on code.google.com by bernardo.damele on 29 Oct 2012 at 11:45

Add NIS security check

Add NIS security check (UPC009 and UPC011)

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 8:49

Add fscaps security check

Add fscaps security check (UPC043)

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 9:01

Enhance AIX support

Enhance AIX support

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 9:09

Fix `which` parsing on Linux

The GNU version of which outputs error messages as follows:

 $ which aaaaaa
 which: no aaaaaa in ...

This isn't handled correctly in lib/misc/file.

Attached patch adds an optional match for "which: " prior to "no ".


Original issue reported on code.google.com by [email protected] on 24 Feb 2015 at 4:23

Attachments:

Fix privileged_dependency

Fix privileged_dependency: currently this is the only extremely slow security 
check

Original issue reported on code.google.com by bernardo.damele on 1 Nov 2012 at 11:49

Add check for R*Services trust relationships

Add check for R*Services trust relationships (both /etc/hosts.equiv and .rhosts 
files in homedirs)

Original issue reported on code.google.com by bernardo.damele on 29 Oct 2012 at 11:39

Add security check privileged_nx

Add security check privileged_nx (UPC040)

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 9:31

process library need to return shell/rb/pl/perl scripts path

process library need to return shell/rb/pl/perl scripts path. At the moment if 
a shell script is being executed, this appears as "/bin/sh my.sh" in the 
process listing and the library returns /bin/sh only

Original issue reported on code.google.com by bernardo.damele on 29 Oct 2012 at 9:36

Add LDAP security check

Add LDAP security check (UPC010 and UPC012)

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 8:48

Implement file grep caching mechanism

Implement file grep caching mechanism: we check some files / dirs multiple times

Original issue reported on code.google.com by bernardo.damele on 29 Oct 2012 at 11:44

Add sudo/sudoers security check

Add sudo/sudoers security check (UPC017 and UPC018) - use recently developed 
sudo library

Original issue reported on code.google.com by bernardo.damele on 22 Oct 2012 at 8:51

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.