Spørmål fra Review Flashcards
Git Gud.
Type of hackers and their motivations
- Black hat hackers: With malicious intent. Often economically or politically motivated (backed by a government).
- White hat hackers: Perform penetration testing to promote security. Often motivated by doing good for others or society at large.
- Script kiddies: Amateurs using publicly available software tools to attack.
- Protest hackers (protest against something e.g. anonymous)
- Grey hat hackers: Usually white hat, but can be black hat
- Red hat hackers: Stopping black hat hackers by attacking them
- Blue hat hackers: Hacking in order to take revenge
- Green hat hackers: beginners to hacking
Differences between ethical and non-ethical hacking
Ethical:
• Promotes security by making vulnerabilities apparent.
• Finds vulnerabilities without causing harm.
• Documents all activities and makes a final presentation and report for the benefit of the victim
Unethical:
• Steals information, modifies data, makes services unavailable for own purposes.
• Finds the easiest way to reach the goal (weakest link)
• Does not care if the system is destroyed (but not too early)
• Documents nothing and actively deletes all clues and traces afterwards.
The usual detailed steps of ethical hacking
- General information gathering.
- Technical information gathering.
- Identifying available hosts computers in the target network.
- Identifying available services in the target network.
- Manual mapping of the services and their responses.
- Automated vulnerability scanning using tools.
- Manual verification of the found vulnerabilities.
- Exploitation of the confirmed vulnerabilities.
- Lateral movements through the local network.
- Ensure access until finished, adding more entry points.
- Achieve goals.
- Remove clues
- Reporting and presentation of the found vulnerabilities.
- Removal of the attacking files.
Google hacking expressions and the type of information that can be obtained
Using specific Google queries we can use smart filtering or get «hidden» data.
Common filters:
“site” filters for a specific domain.
“filetype” filters to file type with extension.
“intitle” filters according to the site title.
“inurl” filters for the url content.
Data that can be obtained: • Default website (domain name) and other sites. • History and public data (faculties, number of staff members) • Key persons with contact details • Important pages • Services • Recent news • Social media info
The technical information of a company
- Domain names of the target
- Domain owner(s) of the target
- Domain registrants
- Ip addresses associated with the target websites
- Ip ranges of the target
- Ip range owner(s)
- List of hosted websites
- Hosting companies
CIDR and usage
In the beginning classful networking was used, but is was wasteful in the way it assigned network ranges. Then CIDR was created to be much less wasting. CIDR stands for Classless InterDomain Routing.
This is done by writing network ranges with two type of bits, one set amount and one fluid amount. For example:
One company has the network range 130.18.0.0 - 130.19.255.255
In CIDR this range can be written as 130.18.0.0/15 because the 15 first bits of the range is the set range:
(10000010.00010010.00000000.00000000) – (10000010.00010011.11111111.11111111)
The rest is the fluid part, therefore you can see that “/x” is the first x amount of bits.
Another example:
- 240.171.56 – 129.240.171.63
(10000001. 11110000.10101011.00111000) – (10000001.11110000.10101011.00111111) - 240.171.56/29 - The first 29 of 32 bits are set; the rest are fluid.
Whois information
The whois database must contain the following information:
- Administrative contact
- Technical contact
- Billing contact
- Name servers
Nameservers are computers that provide subdomain information for the particular domain using the DNS protocol.
The whois protocol is also used to get the owner of a particular ip range.
The records are stored in different databases according to the continents.
The Norwegian entries are stored in the European database (RIPE NCC)
If we don’t know which database to use the general whois protocol helps us.
DNS and its records
DNS servers are all around the world and is organized in a tree structure with 13 root servers. The top level domains (.com, .no) are directly under the root servers. DNS data are stored redundantly. The DNS converts a domain to an IP.
Commands: • Address Mapping records (A) ... • IP Version 6 Address records (AAAA) ... • Canonical Name records (CNAME) ... • Host Information records (HINFO) ... • Mail exchanger record (MX) ... • Name Server records (NS) ... • Reverse-lookup Pointer records (PTR)
Difference between packet switched and circuit switched networks
In circuit switched networks a virtual line is allocated between the communicating parties. The line is busy until the communication ends.
In packet switched networks the caller sends packets to the direction of the receiver. There’s no planned route, each network device chooses the most appropriate device as next considering routing tables and traffic.
To avoid infinite loops, ttl is used (time to live)
The layers of the OSI model
Data - Application Data - Presentation Data - Session Segments - Transport Packets - Network Frames - Data Link Bits - Physical
ICMP protocol and usage (tools)
- To check if a host is responding
- Echo request – Echo reply to make sure a host is turned on
Examples of tools using ICMP:
Ping
Traceroute
Visual Traceroute
Answer types:
• Positive answer
In case of icmp we get an echo reply for our echo request
• Negative answer
In case of icmp we get destination unreachable / host unreachable message
• No answer
In case of icmp, we have no response from the host that was addressed by the echo request
Answers types in case of ping scan and tcp scan
Ping: 0 - Echo reply 3 - Destination unreachable 4 - Source quench 5 - Redirect 8 - Echo request 11 - Time exceeded 12 - Parameter unintelligeble 13 - Time-stamp request 14 - Time-stamp reply 15 - Information request 16 - Information reply 17 - Address mask request 18 - Address mask reply
TCP:
- SYN - SYN+ACK - ACK = Port is open
- SYN - RST = Port is closed
- SYN = Port is filtered
TCP header and flags, handshake
TCP headers consists of 20 bytes of data and a additional 40 bytes of optional data.
In order to ensure that the packages arrives in the right order the sequence number and the acknowledgement number are used.
TCP flags are for maintaining the connection status (urg, ack, psh, rst, syn, fin).
TCP handshake is the process for when a connection is about to be established in a specific port.
32 bits --------------------------------------------------------------------------------- source port | destination port SEQ. number ACK. number Hlen | reserved | URG/ACK/PSH/RST/SYN/FIN | window checksum | urgent pointer [options]
Factory defaults
In earlier years it was not uncommon to see services use factory default credentials. This made them easy to compromise and misuse. This is an example of a configuration error.
It is still common today to see default credentials on things like routers and printers.
Open-relay smtp
An open relay is a SMTP e-mail server that allows third-party relay of e-mail messages.
In case of open relay settings, the user doesn’t need to provide credentials. Anyone can send a mail with arbitrary fields.
How to find/attack open-relay SMTP:
• If one of the client’s SMTP allows open-relay access then any email can be written.
• Spamboxes will probably contain some open-relay SMTP server.
DNS zone transfer
Since DNS data is stored redundantly the slave DNS can ask the master DNS to send a copy of a part of its database (zone) to the slave.
Zone transfer operation should be limited for the slave ip address. If this is not the case, anyone can obtain the whole zone data (and network topological information too).
THC-Hydra, services that can be attacked by Hydra!
Various Cisco services, FTP, Various HTTP functions, IMAP, IRC, MYSQL, POP3, SMTP, SSH, Telnet, VNC, XMPP and many others.
The obligatory header fields of HTTP
Request: • The protocol version • The requested file • The webmethod • The host name
Response:
• The web answer
• The date
• The content type
Information disclosures on a website
Most web sites will disclose some amount of information. The more info the attacker can obtain, the easier the system will be to compromise.
Examples of common disclosure:
Prohibited content for search engines - robots.txt
Dangerous default scripts: e.g. cgibin/test-cgi.
Directory brute-force / dirb to find hidden directories.
Brute-force on a website
Hydra can be used for HTTP brute-forcing. Contrary to the previous cases Hydra needs a keyword to identify negative answers (reverse brute-force).
Example:
hydra -l username -P passwordfile url.to.bf http-post-form “/portal/xlogin/:ed=^USER^&pw=^PASS^:F=Invalid”
Different web servers use different default folders and default files. Dirb has collections of typical webserver related folder names. Dirb also has unified dictionaries (big.txt, common.txt, etc. Dirb brute-forces the folders and files using the dictionaries.