of Services VINCE Agenda definitions services for Windows and - - PowerPoint PPT Presentation

of services
SMART_READER_LITE
LIVE PREVIEW

of Services VINCE Agenda definitions services for Windows and - - PowerPoint PPT Presentation

The Wonderful World of Services VINCE Agenda definitions services for Windows and Linux breaks? auditing Linux logs for Linux useful tools Goals develop a better understanding of Linux and Windows services (How


slide-1
SLIDE 1

The Wonderful World

  • f Services

VINCE

slide-2
SLIDE 2

Agenda

 definitions  services for Windows and Linux  breaks?  auditing Linux  logs for Linux  useful tools

slide-3
SLIDE 3

Goals

 develop a better understanding of Linux and Windows  services (How this ties in with Auditing)  base level auditing  understand logs  pick up some useful tools!  better understanding of what to do initially in a competition

slide-4
SLIDE 4

Services

slide-5
SLIDE 5

What is a Service?

 an application (or set of applications) that runs in the background  this application can enable your box to do a certain task, or carry out essential

tasks

 such as running a web server

slide-6
SLIDE 6

Some Common Services

 Domain Name System (DNS)  Secure Shell (SSH)  Databases – MySQL, MongoDB (Graylog uses this!)  APACHE – cross-platform web server  FTP – File Transfer Protocol

slide-7
SLIDE 7

NECCDC 2018 Services

slide-8
SLIDE 8

Services Operate Over Ports

slide-9
SLIDE 9

We can use nmap to check ports and services!

 We know a lot about nmap around these parts…

slide-10
SLIDE 10

https://www.stationx.net/nmap-cheat- sheet/

slide-11
SLIDE 11
slide-12
SLIDE 12

Why do we need to know ports?

 if you are setting up your firewall, it’s important to make sure you allow traffic over

that port

 you can always change the port (config files)  for example OverTheWire runs ssh over a different port

slide-13
SLIDE 13

Services and Operating Systems

 server-oriented operating

systems are good for services

 as you guys know there is

Windows Server 20XX, you can use this… but no

  • ne likes Windows so,

why?

slide-14
SLIDE 14

What service(s) are on my box?

Older Architectures(S)

 service [SERVICE_NAME] [start | stop | restart | reload | status]

Newer Architectures(S)

 systemctl [start | stop | restart | reload | status] [SERVICE_NAME]

slide-15
SLIDE 15

ls /etc/init.d

slide-16
SLIDE 16

service --status-all

slide-17
SLIDE 17

service --status-all | grep “[+]”

slide-18
SLIDE 18

What about what is not running? service --status-all | grep -v “[+]”

slide-19
SLIDE 19

systemctl -l --type service --all

slide-20
SLIDE 20

You can also run the previous command as root!

slide-21
SLIDE 21
slide-22
SLIDE 22

You can also look into your process manager to see services.

slide-23
SLIDE 23

htop

 htop is not always

there

 sudo apt-get

install htop

slide-24
SLIDE 24

The kill command

slide-25
SLIDE 25

Some Explanation

 the command is used to end a process without having to log out or reboot  a process is also referred to as a task that is in a running state  these processes are given process identification numbers (PID) – we need this as

reference!

slide-26
SLIDE 26

kill [PID]

 this works… but no guarantee the process will end  this by default sends signal 15, sometimes services will ignore this

slide-27
SLIDE 27

kill -9 [PID]

 this command is a little misleading, it doesn’t actually kill the process rather it send a

signal to that process

 what that process does with that signal is up to the process itself  processes have signal handlers, these define what it does with a signal  our command from before “kill [PID]” has no signal supplied, therefore it defaults to

15

 kill -9 [PID] is stronger, this signal is SIGKILL

slide-28
SLIDE 28

kill -l

 we can use this to

see the signal handlers

http://www.linfo.org/kill.html

slide-29
SLIDE 29

pstree -p

 this command is interesting…  we can actually use this to see the parent/ child relationship of processes, and by

killing the parent process this will kill the child processes

 this makes it much easier to end processes, versus manually finding each PID

slide-30
SLIDE 30
slide-31
SLIDE 31

Ross Likes to Kill Bash Sessions

slide-32
SLIDE 32

echo $$

slide-33
SLIDE 33

What happens if I do kill -9 2155?

slide-34
SLIDE 34

WINDOWS LAND!

slide-35
SLIDE 35

Task Manager

slide-36
SLIDE 36

Right click on a service to start or stop it?

slide-37
SLIDE 37

You can search online too!

slide-38
SLIDE 38

services.msc

 CMD -> services.msc  Windows search for “Services”

slide-39
SLIDE 39

These tools are sort of… bland… incomes “Process hacker”

slide-40
SLIDE 40
slide-41
SLIDE 41

Beware some services have dependencies!

 Windows firewall service depends on base filtering engine  some services may not stop or start if a dependency is stopped

slide-42
SLIDE 42

Active Directory

 this is a major Windows directory service!  is AD broken?

 check DNS

 it was DNS…

slide-43
SLIDE 43

That’s all for services, any questions?

slide-44
SLIDE 44

These next slides are mainly competition help!

slide-45
SLIDE 45

Auditing Your Box

 this is very important to in competitions!  we actually covered a lot of auditing by just looking at services!

slide-46
SLIDE 46

1st Step, Check the Users cat /etc/passwd

What do you notice?

slide-47
SLIDE 47
slide-48
SLIDE 48

What to do with these users?

 lock them

 passwd –l [USERNAME]

  • r unlock them

 passwd –u [USERNAME]

 disable them

 passwd –d [USERNAME]

 change their shell

 chsh –s /bin/false [USERNAME]

slide-49
SLIDE 49

Let’s create the user webdude, what happens when we lock that account?

slide-50
SLIDE 50
slide-51
SLIDE 51

Ports your box is listening on? sudo netstat -tulpn

slide-52
SLIDE 52

Another Command, sudo lsof -i

slide-53
SLIDE 53

Don’t forget about nmap!

slide-54
SLIDE 54

Logs

slide-55
SLIDE 55

A Bit About Linux on Logs

 Linux logs provide a timeline of events for the Linux OS, applications, and system  verify useful trouble shooting tool  logs are stored in plaintext and found in /var/log  the next few slides are important logs on debian based systems

slide-56
SLIDE 56

/var/log/kern.log

slide-57
SLIDE 57
slide-58
SLIDE 58

There are tons of log’s for services too. Sometimes a service will generate it’s own log file, such as apache.

slide-59
SLIDE 59

auth.log

 this log contains all successful authentication attempts and failed!

What can or should you look for?

 multiple failed login attempts from a single outside IP  login attempts for system users, (cron) or any unknown user  any know login attempts to root that were not you!

slide-60
SLIDE 60

tail -40 /var/log/auth.log

slide-61
SLIDE 61

Bringing it all together, this is what it is like in the wild…

 https://www.youtube.com/watch?v=W8_Kfjo3VjU

slide-62
SLIDE 62

Was there anything wrong with the web

server?

What command did “web dude” use to

reboot the webserver?

How did “web dude” access Chip’s

computer?

Anything else you noticed?

slide-63
SLIDE 63

STUFF I DIDN’T COVER

 crontabs  firewall appliances (UFW, IPTABLES)  central logging (Graylog!)  host based IDS (OSSEC)  IDS in general (Snort)  chmod and lsattr commands  ssh keys and securing ssh  /etc/shadow  /etc/pam.d  lot’s of Windows stuff ):