Nginx off-by-slash exposes Git config

Febna V M
Published on
20 Dec 2021


Nginx is one of the most commonly used web servers. We can scan for misconfigurations and security vulnerabilities in Nginx. With the Off-by-slash misconfiguration, it is possible to traverse one step up the path due to a missing slash it is possible to read the source code of the web application. The web server responded with a list of files located in the target directory. An attacker can see the files located in the directory and could potentially access files which disclose sensitive information.

Mitigation measures

  • Change your nginx.conf file. A secure configuration for the requested directory similar to the following:
    location /{YOUR DIRECTORY} {
            autoindex off;
  • Configure the web server to disallow directory listing requests.

  • Ensure that the latest security patches have been applied to the web server and the current stable version of the software is in use.

Automated human-like penetration testing for your web apps & APIs
Teams using Beagle Security are set up in minutes, embrace release-based CI/CD security testing and save up to 65% with timely remediation of vulnerabilities. Sign up for a free account to see what it can do for you.

Written by
Febna V M
Febna V M
Cyber Security Engineer
Find website security issues in a flash
Improve your website's security posture with proactive vulnerability detection.
Free website security assessment