. git/config File Leak Repair Tutorial

Source: Internet
Author: User

Aliyun's Cloud Shield system reports a system vulnerability, prompting: System configuration leaks, the path is: 80/.git/config, open with the browser, a text file is downloaded, the contents are as follows (modified):


[Core]
repositoryformatversion = 0
FileMode = True
Bare = False
Logallrefupdates = True
[remote "origin"]
url = xxxxx
Fetch = XXXXXX
[branch "master"]
Remote = origin
Merge = Refs/heads/master

Hackers can use this profile to scan all of the site's directories, even to restore git version, or rather scary, quickly fix this security problem!

Use the Nginx configuration to prevent external access. Git directory

Open the Web site nginx configuration file and add the following configuration:


Location ~/\.git {
Deny all;
}
This prevents access to the. Git directory from the outside, prevents the git configuration file from leaking, turns on the display 403 forbidden again, and then it says OK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.