File Inclusion

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
or

Already have an account? Sign In »

Time
2 hours 5 minutes
Difficulty
Beginner
CEU/CPE
3
Video Transcription
00:00
Hello and welcome back to the course, identifying Web attacks through logs.
00:05
In the last video, we talked about injection attacks and SQL injection attacks.
00:09
In this video, we'll talk about another another injection attack called file Inclusion.
00:14
Let's see the video objectives.
00:16
The video objectives are understanding the local and remote file attacks
00:20
and identifying these attacks using Web server logs.
00:24
First, let's discuss file inclusion attacks.
00:28
As we said before, it's an injection attack.
00:31
It's usually caused by incorrectly using input validation. It's common to see directory trans versatile characters
00:39
thes air two types, local file inclusion that access and execute the local files or commands and remote file inclusion
00:46
that access and execute remote files or commands.
00:50
File inclusion is a server side attack.
00:54
Here you can see how file inclusion works.
00:57
First, local.
00:59
Our request is sent to the server and answered. So it all happens in the same server.
01:04
Remote file inclusion is a little different.
01:07
The user sends the request through the Web server, and they went on. The Web server
01:11
sent the request to another Web server, a remote server.
01:14
That's why it's called remote file inclusion. You need to different servers
01:19
in our lab. We have a Web application that is vulnerable to the file inclusion, both local and remote.
01:26
Here's an example of local inclusion.
01:29
Past WD is a file that contains the pass rich for all the users in a Lennox machine.
01:34
You can see the directory trans Mursal characters, which change the directories.
01:38
The result is the past W D file will be read and displayed in the Web page,
01:42
as you can see in the picture.
01:46
Now, let's analyze some logs together.
01:49
The first logline is a normal request.
01:53
The second logline is a direct request to the past WD file and the Web server answer is not found.
02:00
The 404.
02:01
The request didn't answer
02:04
In the third line, we have a 200 as our answer. So the Web server found the past WD file.
02:10
Notice the difference between the two requests.
02:14
The next line is the same request, but encoded
02:16
as you can see, it worked.
02:19
The Web server answered the past WD file
02:22
since the past WDs local. This attack is a local inclusion
02:28
in these examples, we had access to critical files.
02:31
It's also possible to execute commands on the Web server
02:37
in this table,
02:38
we have a summary of the most common target files for each personal system.
02:44
If you want, pause the video and take some notes
02:47
now some directions to help you identify the local file inclusion.
02:52
Look for operational system commands and files new files, encoded requests and slash on the requests.
03:00
You could go to this website and look from or examples of local file inclusion.
03:05
The next is the remote file inclusion.
03:07
We'll use the same lab.
03:09
The difference between remote and local file inclusion is where the resource is located.
03:15
The remote file inclusion needs to access another servers files. In our example, we'll use We will access the Google website from our lap.
03:23
In the result,
03:24
you can see that the Google search bar is loaded in the lab Web page.
03:29
The remote server is a Google server.
03:30
The remote file inclusion accesses remote servers.
03:35
Now maybe you're thinking, Well, I don't have access to the remote server.
03:38
Can I find the remote file inclusion Attack logs on my Web server?
03:44
Yes, you can find the logs of the attack on your Web server.
03:47
Access on other Web servers is a consequence of the attack.
03:52
Your Web server server
03:53
is the target.
03:54
That's why we will have the locks.
03:58
So let's analyze some logs.
04:00
The first line is the requests to the vulnerable page.
04:04
Notice that there are some log fields missing, like user agent I. P. Address and date and time.
04:10
They were moved to save space.
04:13
In the second line, we have the malicious requests.
04:15
Another page is accessed from our Web page,
04:18
in this case, the Google Web page.
04:20
All the other logs are our Web server. Requesting the Google Web page.
04:26
Our Web server is downloading the Google Web page. That's why we have similar locks. Most of them are pictures.
04:33
The full log of this request is bigger
04:36
here. We only have a small part, but
04:39
all the requests are similar.
04:42
You can use the same directions toe, identify remote and local inclusion.
04:47
Here are some directions more related to remote.
04:51
Look for weird requests,
04:54
as we showed in our other example.
04:56
Requests for another Web server, like outside of traffic, is suspicious.
05:00
If the server is accessing a wrote a remote server,
05:03
maybe you can see an increase in Web server download traffic
05:06
here to look for encoded requests in the user agent.
05:12
Look for uncommon user agents or vulnerability scanners.
05:16
Post assessment question.
05:19
Analyze the Web server, log below and choose the type of attack.
05:23
You can pause the video if you'd like.
05:26
The answer is number four
05:28
Remote file Inclusion.
05:30
Let's analyze the log together and see why
05:32
we have the I P address date in time and the requested file. And we have to get method.
05:40
If you look at the requested file, you can see there's another address in the page. So we have a remote file inclusion because we're trying to access a remote server.
05:48
Here is the Sai Buri Web page. All the other fields air. Okay, we have the 200. That means okay,
05:55
we have the refer and the user agent.
05:59
For the next question,
06:00
analyze the weblog below and identify which Web pages vulnerable to file inclusion. Attack.
06:05
Here you have the request, and you have a small part of the full Web page. But
06:11
you can see the malicious request,
06:13
although if you look to the refer, we can see there's no Web page.
06:16
Remember that the refer could be crafted to, but sometimes it can help
06:20
in this case, it's possible to find the vulnerable Web page. Here's the answer.
06:26
Video summary
06:28
In this video, we learned about local and remote file inclusion attack in their differences.
06:32
We used it in our lab to generate some Web server logs and analyzing the Web server logs, we identified both types of attacks local and remote file inclusion.
06:43
We also gave some directions to identify the attacks like we had requests, encoded requests, user agents, requests with operational system commands or files requests, many slashes and some specific directions for the remote file inclusion like the request to the outside.
07:00
In the next video, we'll analyze cross site scripting attacks and will identify the attack using Web server logs.
Up Next
Identifying Web Attacks Through Logs

This course will review web application infrastructure, web servers, and the logs associated with them. We will also simulate 10 attack scenarios and identify the attack through logs that are generated by the web server.

Instructed By