Several people have recently queried me about log entries related to the SY0-401 and SY0-501 Security+ exam. People that have worked in networking jobs for the past couple of years have likely seen log entries from many different sources.
However, many people are required to earn the Security+ certification that haven’t necessarily worked in networking jobs. Additionally, some IT jobs don’t require technicians to routinely review and analyze logs so they might be confused by them.
However, with some basic knowledge and applying some critical thinking skills, you should be able to figure many of them out.
Sample Log Entry Practice Test Question
As an example, consider the following Security+ practice test question that I recently added to the test banks on the gcgapremium.com site.
Q. Your IPS recently raised an alert from the following log entry on of your organization’s web servers:
04/23/18 23:13:50 httpd: GET /wp/forms/process.php?input=cd%20../../../etc;cat%20shadow
Based on this log entry, which of the following is MOST likely occurring
A. False negative
B. XSS attack
C. Command injection attack
D. Password attack
E. Buffer overflow attack
The answer (and full explanation) is at the end of this blog post.
Analyzing the Log Entry
In most log entries (if not all), you will see a time stamp somewhere within the log entry. This entry indicates it was logged on April 23, 2018 (04/23/18) at about 50 seconds after 11:13 PM (23:13:50). Note that the date could be entered as an easier to recognize date like this:
Apr 23 2018 23:13:50...
Log entries typically use a 24 hour clock instead of dividing time into AM and PM. One way of determining the actual time after 1 PM is to subtract 12 from the first number if it is greater than 12. In this case, 23-12 is 11, indicating 11 PM.
Next, in the entry is httpd. Hopefully, you’ll recognize that this represents the Hypertext Transfer Protocol (HTTP) used on the Internet to serve up web pages.
04/23/18 23:13:50 httpd:
What about the extra D? It represents a daemon. A daemon is a process that runs in the background on a Linux systems, similar to how services run in the background on Windows systems. HTTPD indicates it is a daemon handling HTTP requests.
Next is the GET command.
04/23/18 23:13:50 httpd: GET
This is where CompTIA is making the Security+ exam more focused on programmers and developers. This is admittedly a little odd, considering that recommend experience says nothing about development experience, but only mentions “experience in IT administration with a security focus.”
Developers that have done web page development using common languages such as Python, PHP, and JavaScript understand that GET is an HTTP command used to retrieve something, such as a web page. However, for a Cisco expert that knows routers and switches inside and out, this isn’t common knowledge.
At any rate, you can think of GET as a simple read command. What is it trying to read? The answer is in the following section:
GET /wp/modules/process.php?input=cd%20../../../etc;cat%20shadow
There are a couple of things going in this part of the entry, but it’s important to realize that is a single line of code with multiple elements.
First, it is running a PHP program called process.php, which is a generic name for a PHP module typically used to process web page forms. The module would typically be within another directory, so the code adds the appropriate path (/wp/forms/ in this scenario) before the module name.
The next part (?input=cd%20../../../etc;cat%20shadow) is very likely the malicious code. It indicates that it is retrieving data and passing it back to the process.php module.
If you’ve done some work with the command line on Linux systems, the commands should be familiar. The %20 indicates a space, so the this is essentially the following two commands:
cd ../../../etc
cat shadow
The first command (cd) changes the directory to the etc directory.
The second command (cat shadow) attempts to read the shadow file, which is an encrypted form of the password file.
The code than passes the password file back to the process.php file as an input.
But here’s a question to ask. Why would a PHP module be retrieving the password file?
Hint: It shouldn’t.
Is This Normal?
A PHP module used to process forms would NOT be trying to retrieve the entire contents of the shadow file.
Additionally, it is NOT natural for an HTTP GET command to execute commands normally run at the Linux terminal or a Windows command line.
Command Injection Attack
Here’s a snippet from Chapter 7 of the CompTIA Security+ Get Certified Get Ahead: SY0-501 Study Guide.
“In some cases, attackers can inject operating system commands into an application using web page forms or text boxes. Any web page that accepts input from users is a potential threat. Directory traversal is a specific type of command injection attack that attempts to access a file by including the full directory path, or traversing the directory structure.”
In this scenario, the attacker used directory traversal to first access the /etc/ folder. It then used the cat shadow command to access the encrypted passwords.
Did it work? We don’t know.
Hopefully, the process.php file is using adequate input validation techniques to block this type of attack.
Sample Log Entry Practice Test Question Answer
Q. Your IPS recently raised an alert from the following log entry on of your organization’s web servers:
04/23/18 23:13:50 httpd: GET /wp/forms/process.php?input=cd%20../../../etc;cat%20shadow
Based on this log entry, which of the following is MOST likely occurring
A. False negative
B. XSS attack
C. Command injection attack
D. Password attack
E. Buffer overflow attack
Answer: This is a command injection attack because it is attempting to run the cd and cat commands.
A false negative indicates an attack is occurring, but a system such as the intrusion prevention system (IPS) is not detecting the attack. Because the IPS raised an alert, it is not a false negative.
A cross-site scripting (XSS) attack used embedded HTML or JavaScript code, not command-line commands.
A password attack attempts to discover passwords. While this looks like it may be trying to discover passwords, it is unlikely to do so if the process.php module is using adequate input validation.
A buffer overflow occurs if an application receives more data than it could handle. If the process.php module is not using adequate input validation techniques, this could result in a buffer overflow problem, but there isn’t any indication that it did cause a buffer overflow issue.
1 thought on “Log Entries and Security+”