首页 > 其他分享 >【THM】Git Happens练习

【THM】Git Happens练习

时间:2024-10-02 13:04:42浏览次数:1  
标签:Happens Git Author 23 Jul THM 2020 Date commit

【THM】Git Happens练习

与本文相关的TryHackMe实验房间链接:TryHackMe | Git Happens

简介:老板让我创建一个原型代码,所以它就在这里!我们甚至使用了一种叫做“版本控制”的东西,使部署变得非常容易!

TryHackMe

你能找到应用程序的密码吗?

image-20241002120210087

第一题:找到超级机密的密码

第一步

端口扫描

首先使用nmap对端口进行扫描

nmap -Pn -sV -T4 -A 10.10.139.132

-A 启动Os检测,版本检测,脚本扫描和traceroute

image-20241002120359614

可以发现目标开放了1个端口:80/tcp http服务,并且运行的是git服务器

第二步

访问网站

我们先进入网站看看界面

image-20241002120518911

是一个登录界面

第三步

信息收集

我们先看看网页的源码里面会不会藏了什么东西,啥也没有

再优先查看robots.txt来看看这个网站会不会有什么见不得人的文件,404 not found

使用gobuster工具扫描网站目录(这里用了fuzzdict master的字典):

gobuster dir -u http://10.10.139.132 -w top7000.txt

image-20241002120936012

我们尝试访问/.git/发现可以进入

.git文件夹

.git/ 目录是 Git 版本控制系统在每个 Git 仓库中自动创建的隐藏目录。它包含了该仓库的所有版本历史、配置信息和元数据。

(字典不够强大扫不出来,平时用dirsearch就好了)

image-20241002121026919

第四步

git泄露漏洞利用

该网站存在git泄露,我们使用GitTools将git仓库下载到我们的攻击机上。

GitTools仓库中有三个工具,它们是Dumper, Extractor和Finder

Dumper 将/.git/内容转储到本机

Extractor 还原不完整的仓库内容,用于分析和提取 Git 仓库中的敏感数据

Finder 用于扫描和发现存在 Git 仓库的公共网站或资源

使用gitdumper,将git内容dump到攻击机,存储在nihao文件夹中:

./gitdumper.sh  http://10.10.139.132/.git/ ./nihao/

image-20241002122822479

dump成功后文件夹是空的,.git文件是隐藏的

第五步

分析Git仓库

我们使用以下命令查看 Git 仓库提交历史:

git log

得到以下输出:

commit d0b3578a628889f38c0affb1b75457146a4678e5 (HEAD -> master, tag: v1.0)
Author: Adam Bertrand <[email protected]>
Date:   Thu Jul 23 22:22:16 2020 +0000

    Update .gitlab-ci.yml

commit 77aab78e2624ec9400f9ed3f43a6f0c942eeb82d
Author: Hydragyrum <[email protected]>
Date:   Fri Jul 24 00:21:25 2020 +0200

    add gitlab-ci config to build docker file.

commit 2eb93ac3534155069a8ef59cb25b9c1971d5d199
Author: Hydragyrum <[email protected]>
Date:   Fri Jul 24 00:08:38 2020 +0200

    setup dockerfile and setup defaults.

commit d6df4000639981d032f628af2b4d03b8eff31213
Author: Hydragyrum <[email protected]>
Date:   Thu Jul 23 23:42:30 2020 +0200

    Make sure the css is standard-ish!

commit d954a99b96ff11c37a558a5d93ce52d0f3702a7d
Author: Hydragyrum <[email protected]>
Date:   Thu Jul 23 23:41:12 2020 +0200

    re-obfuscating the code to be really secure!

commit bc8054d9d95854d278359a432b6d97c27e24061d
Author: Hydragyrum <[email protected]>
Date:   Thu Jul 23 23:37:32 2020 +0200

commit d0b3578a628889f38c0affb1b75457146a4678e5 (HEAD -> master, tag: v1.0)
Author: Adam Bertrand <[email protected]>
Date:   Thu Jul 23 22:22:16 2020 +0000

    Update .gitlab-ci.yml

commit 77aab78e2624ec9400f9ed3f43a6f0c942eeb82d
Author: Hydragyrum <[email protected]>
Date:   Fri Jul 24 00:21:25 2020 +0200

    add gitlab-ci config to build docker file.

commit 2eb93ac3534155069a8ef59cb25b9c1971d5d199
Author: Hydragyrum <[email protected]>
Date:   Fri Jul 24 00:08:38 2020 +0200

    setup dockerfile and setup defaults.

commit d6df4000639981d032f628af2b4d03b8eff31213
Author: Hydragyrum <[email protected]>
Date:   Thu Jul 23 23:42:30 2020 +0200

    Make sure the css is standard-ish!

commit d0b3578a628889f38c0affb1b75457146a4678e5 (HEAD -> master, tag: v1.0)
Author: Adam Bertrand <[email protected]>
Date:   Thu Jul 23 22:22:16 2020 +0000

    Update .gitlab-ci.yml

commit 77aab78e2624ec9400f9ed3f43a6f0c942eeb82d
Author: Hydragyrum <[email protected]>
Date:   Fri Jul 24 00:21:25 2020 +0200

    add gitlab-ci config to build docker file.

commit 2eb93ac3534155069a8ef59cb25b9c1971d5d199
Author: Hydragyrum <[email protected]>
Date:   Fri Jul 24 00:08:38 2020 +0200

    setup dockerfile and setup defaults.

commit d6df4000639981d032f628af2b4d03b8eff31213
Author: Hydragyrum <[email protected]>
Date:   Thu Jul 23 23:42:30 2020 +0200

    Make sure the css is standard-ish!

commit d954a99b96ff11c37a558a5d93ce52d0f3702a7d
Author: Hydragyrum <[email protected]>
Date:   Thu Jul 23 23:41:12 2020 +0200

    re-obfuscating the code to be really secure!

commit bc8054d9d95854d278359a432b6d97c27e24061d
Author: Hydragyrum <[email protected]>
Date:   Thu Jul 23 23:37:32 2020 +0200

commit e56eaa8e29b589976f33d76bc58a0c4dfb9315b1
Author: Hydragyrum <[email protected]>
Date:   Thu Jul 23 23:25:52 2020 +0200

    Obfuscated the source code.
    
    Hopefully security will be happy!

commit 395e087334d613d5e423cdf8f7be27196a360459
Author: Hydragyrum <[email protected]>
Date:   Thu Jul 23 23:17:43 2020 +0200

    Made the login page, boss!

commit 2f423697bf81fe5956684f66fb6fc6596a1903cc
Author: Adam Bertrand <[email protected]>
Date:   Mon Jul 20 20:46:28 2020 +0000

    Initial commit

日志中的内容分为以下部分:

commit	当前提交的哈希值
(HEAD -> master, tag: v1.0)	表示当前处于 master 分支,并且 HEAD 指向最新的提交
Author	作者信息
Date	日期
提交信息(备注)

我们可以发现哈希值为395e087334d613d5e423cdf8f7be27196a360459的日志中有一条说“做好了登录页面老板!”,我们着重分析

git show 395e087334d613d5e423cdf8f7be27196a360459

git show 命令用于显示特定提交的详细信息,包括提交的内容、修改的文件和差异

image-20241002123742217

我们可以在底部发现admin用户的password

就是我们要找的超级机密的密码

image-20241002124051954

标签:Happens,Git,Author,23,Jul,THM,2020,Date,commit
From: https://www.cnblogs.com/handsomexuejian/p/18444574

相关文章

  • Study Plan For Algorithms - Part48
    1.不同的二叉搜索树II给定一个整数n,请生成并返回所有由n个节点组成且节点值从1到n互不相同的不同二叉搜索树。classSolution:defgenerateTrees(self,n:int)->List[Optional[TreeNode]]:ifn==0:return[]returnself.g......
  • vue2接入高德地图实现折线绘制、起始点标记和轨迹打点的完整功能(提供Gitee源码)
    目录一、申请密钥二、安装element-ui三、安装高德地图依赖四、完整代码五、运行截图六、官方文档七、Gitee源码一、申请密钥登录高德开放平台,点击我的应用,先添加新应用,然后再添加Key。​如图所示填写对应的信息,系统就会自动生成。​二、安装element-ui没安装的......
  • linux 上安装gitlab代码仓库
    作者:程序那点事儿日期:2024/02/0804:06安装过程安装节点:192.168.43.106wgethttps://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-15.9.1-ce.0.el7.x86_64.rpmrpm-igitlab-ce-15.9.1-ce.0.el7.x86_64.rpmvim/etc/gitlab/gitlab.rbgitlab-ctl......
  • Jenkins拉取代码报错通过git配置浅克隆
    在Linux中,使用gitconfig命令配置depth为1意味着你想要为你的Git仓库设置一个浅克隆(shallowclone)。浅克隆会克隆仓库的历史记录中的一个极简版本,通常只包含最近的一次提交。这样做可以节省带宽和时间,特别是对于那些不需要完整历史记录的项目。要配置深度为1的浅克隆,你可以使用以......
  • 项目部署一:前期准备(本地上传、gitignore、ssh连接、密钥)
    项目部署想要将django项目部署在服务器上,本质上需要三大部分:将代码上传到服务器在服务器上获取代码、安装服务、配置环境启动服务1.代码同步上传代码的方式有很多种,例如:FTP工具、scp命令、rsync服务、svn等,不过目前公司主流的都是使用git+代码托管平台。本地电脑,安装......
  • Gitee简单操作
    gitee上传代码第一步:电脑上先安装git:下载链接https://git-scm.com/downloads#如果在桌面鼠标右键,出现下面两个东西,则安装成功openGitGUIhereopenGitBashhere第二步:注册gitee/github第三步:创建项目仓库(点击右上角+号)本地git配置-全局(最开始做一......
  • git
    what'sdifferencebetweengitrevertandgitreset.都是撤销修改记录,其中,reset是取消一个提交;revert是修改内容然后生成一个新的提交。必须指出的是:reset在远程不生效,如果需要撤销远程的提交,需要使用revert.gitcherry-pickandinteractivegitrebase当你需要......
  • Study Plan For Algorithms - Part47
    1.复原IP地址有效IP地址正好由四个整数(每个整数位于0到255之间组成,且不能含有前导0),整数之间用'.'分隔。给定一个只包含数字的字符串s,用以表示一个IP地址,返回所有可能的有效IP地址,这些地址可以通过在s中插入'.'来形成。classSolution:defrestoreI......
  • git 生成ssh key
    文件目录下  1、ssh-keygen-trsa-b4096-C"自己的邮箱地址"2、ls-la查看所有文件3、cat~/.ssh/id_rsa.pub//文件里面的全部复制 4、在GitHub账户的Settings中添加SSHkey:登录GitHub。点击右上角的头像,然后点击Settings。在用户设置页面......
  • Github_以太网开源项目verilog-ethernet代码阅读与移植(五)
    实验背景在(四)中介绍了Github开源项目verilog-ethernet的移植思路,以及对MII接口和数据链路层等功能的仿真,下面介绍数据的跨时钟域传输,以太网数据传输过程和网络层数据传输相关的移植。实验内容数据的跨时钟域传输处理,以太网数据传输过程和网络层数据传输模块介绍与仿真。......