Free Privileged Account Discovery Tool: Identify & secure credentials to stop lateral movement. Download Free

BeyondTrust
  • Products
    Privileged Password Management
    Discover, manage, audit, and monitor privileged accounts
    Password Safe DevOps Secrets Safe
    Endpoint Privilege Management
    Manage privileges on Windows, Mac, Linux, and Unix endpoints
    Windows and Mac Unix and Linux Active Directory Bridge
    Secure Remote Access
    Centrally manage and secure remote access for service desks and vendors
    Remote Support Privileged Remote Access
    BeyondInsight Analytics
    See All Solutions
  • Resources

    Universal Privilege Management

    Our innovative Universal Privilege Management approach secures every user, asset, and session across your entire enterprise.

    Watch Video

    Learn

    Case Studies
    Competitor Comparisons
    Datasheets
    Glossary
    Product Demos
    Whitepapers

    Attend

    Events
    Go Beyond
    Training
    Webinars

    Support

    Changelog
    Professional Services
    Technical Documentation
  • Blog
  • Partners
  • Contact
  • Support
  • Services
  • Training
  • Events
  • Company

Breaking Local File Inclusion Attacks with Security Hardening, Cyberpunk-Style

January 31, 2019

  • Blog
  • Archive

In episode 6 (Wintermute) of my Attacking and Defending Linux webinar series, we attack a capture the flag (CTF) exercise that follows the plot of the famed William Gibson cyberpunk novel, Neuromancer.

The Wintermute CTF is particularly interesting because it involves two virtual machines—and you have to hack the first, Straylight, before you can reach the target, Neuromancer. Once we've finished executing the attack, we discuss and demonstrate a defense to show how a proactive security hardening measure would block this cyberattack.

To complete an attack in this CTF exercise, we must exploit five vulnerabilities, one by one. One of the critical vulnerabilities in the chain is a Local File Inclusion, where we find a drop-down menu item that has four available options, "case," "molly," "armitage," and "riviera." These turn out to be files that are included into the results page, /a/directory/path/NAME.log, where NAME is expected to be one of the four items from the drop-down.

To exploit the vulnerability, we use a simple tool to submit an unexpected input, namely ../../../../../../var/log/mail, so that, instead of rendering /a/directory/path, the system renders /a/directory/path/../../../../../../var/log/mail.log, or, put simply, /var/log/mail.log. This, in turn, lets us render the mail server's primary log file. Once we send mail to the system containing PHP code in the From: field, requests for the vulnerable page cause the system to run our PHP code.

This kind of vulnerability feels particularly silly, doesn't it? The core problem is that the web application trusts the user to submit only the four values that were in the drop-down. Now, let's assume we don't know that the vulnerability is present, and have to proactively fix it. In the webinar, we take one approach, so let's now consider a different one here.

We could prevent the hostile input from reaching the server. One way to do this would be to create a block list filter in front of the application, preventing input that looks like a local file inclusion attack (../../../) or other hostile attacks. You could do this with a web application firewall (WAF) or intrusion prevention system (IPS). The free OWASP ModSecurity core ruleset would do this. Alternatively, you could create a allow list filter that prevents any input into that NAME slot that didn't match the four names from the drop-down. You could accomplish this with ModRewrite or ModSecurity, using a custom rule. Both approaches work—the former is less labor intensive, while the latter is more secure.

If you enjoyed reading about either the attack, the cyber defense, or both, check out the on-demand webinar!

Jay Beale

co-founder, COO and CTO, InGuardians

Jay Beale has created several defensive security tools, including Bastille Linux/UNIX and the CIS Linux Scoring Tool, both of which were used widely throughout industry and government. He has served as an invited speaker at many industry and government conferences, a columnist for Information Security Magazine, SecurityPortal and SecurityFocus, and a contributor to nine books, including those in his Open Source Security Series and the “Stealing the Network” series. He has led training classes on Linux Hardening and other topics at Black Hat, CanSecWest, RSA, and IDG conferences, as well as in private corporate training. Jay is a co-founder, Chief Operating Officer and CTO of the information security consulting company InGuardians.

Stay Up To Date

Get the latest news, ideas, and tactics from BeyondTrust. You may unsubscribe at any time.

I agree to receive product related communications from BeyondTrust as detailed in the Privacy Policy, and I may manage my preferences or withdraw my consent at any time.

You May Also Be Interested In:

Webcasts | February 09, 2021

Customer Webinar: Remote Support 21.1 Released!

Webcasts | February 24, 2021

Your PAM 2021 Blueprint: Securing Privileged Accounts for On-Premises and Cloud Assets

Whitepapers

Evolving Privileged Identity Management (PIM) In The 'Next Normal'

BeyondTrust Logo
  • Facebook
  • Twitter
  • LinkedIn

Keep up with BeyondTrust

I agree to receive product related communications from BeyondTrust as detailed in the Privacy Policy, and I may manage my preferences or withdraw my consent at any time.

Customer Support
Contact Sales

Products

  • Endpoint Privilege Management
  • Password Management
  • Privileged Remote Access
  • DevOps Secrets Safe
  • Remote Support

Resources

  • Blog
  • Case Studies
  • Competitor Comparisons
  • Datasheets
  • Glossary
  • Videos
  • Webcasts
  • Whitepapers

About

  • Company
  • Careers
  • Contact
  • Events
  • Leadership Team
  • Partner Program
  • Press

Languages

  • English
  • German
  • French
  • Spanish
  • Korean
  • Portuguese
  • Japanese
  • Privacy
  • Security
  • Manage Cookies
  • WEEE Compliance

Copyright © 1999 — 2020 BeyondTrust Corporation. All rights reserved. Other trademarks identified on this page are owned by their respective owners. BeyondTrust Corporation is not a chartered bank or trust company, or depository institution. It is not authorized to accept deposits or trust accounts and is not licensed or regulated by any state or federal banking authority.