SlideShare a Scribd company logo
3
Most read
Local File Inclusion
& Path Traversal
OWASP Web App Top 10
by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
What is it?
“Local File Traversal (LFI)” is a
vulnerability that allows files hosted
on the server to be included and
potentially also executed. Using
“path traversal”, files located outside
of the current folder can be
accessed.
What causes it?
This vulnerability exploits the "dynamic file
include" mechanism that exists in
programming frameworks. A local file
inclusion happens when uncontrolled user
input (forms, headers, …) is used as
parameter to "file include“ commands. Path
traversal is possible because characters like
‘../’ (or encoded versions) are not being
checked against.
What could happen?
Depending on system access
restrictions various sensitive
files could be read or
executed. Password files,
database configuration files
or the database content itself
could be stolen. Remote code
could get executed.
How to prevent it?
Never directly pass user input to “file include”
commands: use an indirect reference map
instead. Alternatively, apply white-list
validation against all user controllable input,
e.g. reject ‘../’ and encoded variants.
Local File Inclusion / Path traversal
Understanding the security vulnerability
A vulnerable site uses the
‘page’ parameter which it
includes to dynamically
build the content of the site.
An attacker uses the ’page’
parameter to craft a URL to
try to access sensitive files
in other directories.
Eventually he finds the
correct path. User
account information is
returned to the output.
Using path traversal and
trial and error, he submits
manipulated requests to
the application server.
Application Server
http://site.com/?page=home
http://site.com/?page=../../../../../../etc/passwd
page = request.getParameter(‘page’);
echo include(page);
…
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
alex:x:500:500:alex:/home/alex:/bin/bash
…
/etc/passwd
http://site.com/?page=../../../../../etc/passwd
http://site.com/?page=../../../../etc/passwd
Local File Inclusion / Path traversal
Realizing the impact
Next to reading files, advanced attacks can also
result in the execution of arbitrary malicious code
under specific circumstances.
A compromised server could lead to availability loss
and cause reputational and financial damages.
Customer data could get exposed, leading to
privacy issues, reputational and financial damages.
Local File Inclusion / Path traversal
Preventing the mistake
Use indirect object reference maps.
Apply white-list input validation.
Form parameters, cookies, HTTP headers.
Pay special attention to ‘../’ and encoded variants.
/index?page=about.html
/index?page=1
Static ID targetPage
1 about.html
2 home.html
Indirect object
reference map

More Related Content

What's hot (20)

PPTX
Secure Code Warrior - Unrestricted file upload
Secure Code Warrior
 
PPTX
Web application attack Presentation
Khoa Nguyen
 
PPTX
Secure Code Warrior - Local storage
Secure Code Warrior
 
PPTX
Website hacking and prevention (All Tools,Topics & Technique )
Jay Nagar
 
PPTX
File inclusion
AaftabKhan14
 
PPT
Application Security
nirola
 
PDF
Abusing, Exploiting and Pwning with Firefox Add-ons
Ajin Abraham
 
PPTX
Abusing Exploiting and Pwning with Firefox Addons
Ajin Abraham
 
PPTX
Web Security Attacks
Sajid Hasan
 
PPTX
FI-WARE OAUTH-XACML-based API Access Control - Overview (Part 1)
cdanger
 
PDF
Is Drupal secure?
Four Kitchens
 
PPT
Drupal security
Techday7
 
PPTX
Ethical hacking Chapter 10 - Exploiting Web Servers - Eric Vanderburg
Eric Vanderburg
 
PPTX
Artem Сhaykin. Android Application Security.
Positive Hack Days
 
ODP
Web Security
Chatree Kunjai
 
PPT
Pentesting web applications
Satish b
 
PPTX
Owasp healthcare cms
uisgslide
 
PPT
Hacking web applications
Adeel Javaid
 
PDF
Testing REST Web Services
Jan Algermissen
 
Secure Code Warrior - Unrestricted file upload
Secure Code Warrior
 
Web application attack Presentation
Khoa Nguyen
 
Secure Code Warrior - Local storage
Secure Code Warrior
 
Website hacking and prevention (All Tools,Topics & Technique )
Jay Nagar
 
File inclusion
AaftabKhan14
 
Application Security
nirola
 
Abusing, Exploiting and Pwning with Firefox Add-ons
Ajin Abraham
 
Abusing Exploiting and Pwning with Firefox Addons
Ajin Abraham
 
Web Security Attacks
Sajid Hasan
 
FI-WARE OAUTH-XACML-based API Access Control - Overview (Part 1)
cdanger
 
Is Drupal secure?
Four Kitchens
 
Drupal security
Techday7
 
Ethical hacking Chapter 10 - Exploiting Web Servers - Eric Vanderburg
Eric Vanderburg
 
Artem Сhaykin. Android Application Security.
Positive Hack Days
 
Web Security
Chatree Kunjai
 
Pentesting web applications
Satish b
 
Owasp healthcare cms
uisgslide
 
Hacking web applications
Adeel Javaid
 
Testing REST Web Services
Jan Algermissen
 

Similar to Secure Code Warrior - Local file inclusion (20)

PPTX
Directory Traversal & File Inclusion Attacks
Raghav Bisht
 
PDF
CNIT 129S: 10: Attacking Back-End Components
Sam Bowne
 
PDF
Session9-File Upload Security
zakieh alizadeh
 
PPTX
Secure Code Warrior - Remote file inclusion
Secure Code Warrior
 
PDF
Local File Inclusion to Remote Code Execution
n|u - The Open Security Community
 
PDF
Ch 10: Attacking Back-End Components
Sam Bowne
 
PDF
Ch 13: Attacking Other Users: Other Techniques (Part 1)
Sam Bowne
 
PDF
Directory_Traversel.pdf
Okan YILDIZ
 
PDF
File Inclusion.pdf
Okan YILDIZ
 
PPTX
Security hole #5 application security science or quality assurance
Tjylen Veselyj
 
PDF
LFI to RCE Exploit with Perl Script
Prathan Phongthiproek
 
PPTX
Directory traversal
penetration Tester
 
PDF
Remote file path traversal attacks for fun and profit
Dharmalingam Ganesan
 
DOCX
Web-servers & Application Hacking
Raghav Bisht
 
PDF
Remote File Inclusion / Local File Inclusion [Attack and Defense Techniques]
Ismail Tasdelen
 
PPTX
VAPT_FINAL SLIDES.pptx
karthikvcyber
 
DOCX
Continuing in your role as a human service provider for your local.docx
richardnorman90310
 
PPTX
Introduction to path traversal attack
Prashant Hegde
 
Directory Traversal & File Inclusion Attacks
Raghav Bisht
 
CNIT 129S: 10: Attacking Back-End Components
Sam Bowne
 
Session9-File Upload Security
zakieh alizadeh
 
Secure Code Warrior - Remote file inclusion
Secure Code Warrior
 
Local File Inclusion to Remote Code Execution
n|u - The Open Security Community
 
Ch 10: Attacking Back-End Components
Sam Bowne
 
Ch 13: Attacking Other Users: Other Techniques (Part 1)
Sam Bowne
 
Directory_Traversel.pdf
Okan YILDIZ
 
File Inclusion.pdf
Okan YILDIZ
 
Security hole #5 application security science or quality assurance
Tjylen Veselyj
 
LFI to RCE Exploit with Perl Script
Prathan Phongthiproek
 
Directory traversal
penetration Tester
 
Remote file path traversal attacks for fun and profit
Dharmalingam Ganesan
 
Web-servers & Application Hacking
Raghav Bisht
 
Remote File Inclusion / Local File Inclusion [Attack and Defense Techniques]
Ismail Tasdelen
 
VAPT_FINAL SLIDES.pptx
karthikvcyber
 
Continuing in your role as a human service provider for your local.docx
richardnorman90310
 
Introduction to path traversal attack
Prashant Hegde
 
Ad

Recently uploaded (20)

PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Ad

Secure Code Warrior - Local file inclusion

  • 1. Local File Inclusion & Path Traversal OWASP Web App Top 10 by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
  • 2. What is it? “Local File Traversal (LFI)” is a vulnerability that allows files hosted on the server to be included and potentially also executed. Using “path traversal”, files located outside of the current folder can be accessed. What causes it? This vulnerability exploits the "dynamic file include" mechanism that exists in programming frameworks. A local file inclusion happens when uncontrolled user input (forms, headers, …) is used as parameter to "file include“ commands. Path traversal is possible because characters like ‘../’ (or encoded versions) are not being checked against. What could happen? Depending on system access restrictions various sensitive files could be read or executed. Password files, database configuration files or the database content itself could be stolen. Remote code could get executed. How to prevent it? Never directly pass user input to “file include” commands: use an indirect reference map instead. Alternatively, apply white-list validation against all user controllable input, e.g. reject ‘../’ and encoded variants.
  • 3. Local File Inclusion / Path traversal Understanding the security vulnerability A vulnerable site uses the ‘page’ parameter which it includes to dynamically build the content of the site. An attacker uses the ’page’ parameter to craft a URL to try to access sensitive files in other directories. Eventually he finds the correct path. User account information is returned to the output. Using path traversal and trial and error, he submits manipulated requests to the application server. Application Server http://site.com/?page=home http://site.com/?page=../../../../../../etc/passwd page = request.getParameter(‘page’); echo include(page); … root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin alex:x:500:500:alex:/home/alex:/bin/bash … /etc/passwd http://site.com/?page=../../../../../etc/passwd http://site.com/?page=../../../../etc/passwd
  • 4. Local File Inclusion / Path traversal Realizing the impact Next to reading files, advanced attacks can also result in the execution of arbitrary malicious code under specific circumstances. A compromised server could lead to availability loss and cause reputational and financial damages. Customer data could get exposed, leading to privacy issues, reputational and financial damages.
  • 5. Local File Inclusion / Path traversal Preventing the mistake Use indirect object reference maps. Apply white-list input validation. Form parameters, cookies, HTTP headers. Pay special attention to ‘../’ and encoded variants. /index?page=about.html /index?page=1 Static ID targetPage 1 about.html 2 home.html Indirect object reference map