hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)

admin 2024年8月28日22:53:43hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)已关闭评论22 views字数 2097阅读6分59秒阅读模式

本题没有得到最后的flag,只是为了整理相关的知识。

KeePass是中密码数据库管理工具,其中存储着一些密码,本题给了一个数据库以及一个加密文件
hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)

  • 首先识别以下database的类型

hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)
下载keepass数据库管理工具

  • 打开发现需要密码

hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)

  • 利用John the Ripper得到Database的hash

john下载地址
hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)

$keepass$*2*60000*0*25798eeae830af9553a0d2beecfef834aba3a2f36cd78ec177287fdc102ca566*35287f29a42862c3b3522234f285fb091c1cac0e9bc7452dcc47a98599850083*9eb177215208b631b9a84c04a128f972*dbbfbd8653604286bb5e8d43c72cee9ce9f18074e0b8f202c79bb2475f906b1b*1bea912d6925ed287227ac86746402ee8c04df083b95859fbdc1203b50a620e7
  • 1

使用hashcat爆破hash值得到密码

hashcat -m 13400 keepass.txt  -a 0 password.txt  --force  
  • 1

参数解释:

m: 破解的hash类型,hashcat -h 何查看类型
a: 爆破的方法,0表示字典爆破
force :不报错
hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)成功破解,并查看破解的密码

hashcat -m 13400 keepass.txt  -a 0 password.txt  --show
  • 1

hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)发现密码为空。。。 进入后可以看到压缩密码
hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)打开后发现一张图片,放进stegsolve后可以看到明显的stegpy隐写特征
hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)
hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)
结合题目名(Boom)可以知道是stegpy爆破
利用脚本和字典最后可以爆破出密码:

脚本来自VNCTF 2021


import os
from subprocess import Popen,PIPE
import sys
def checkwebp(pic):
    print("IF you don't need a password for the pic please input 1") 
    print("IF you know the password of the pic please input 2") 
    print("IF not input 3 I will use the password.txt") 
    choice = input()
    if choice == '1':
        os.system("stegpy {}".format(pic))
    elif choice == '2':
        print("INPUT THE password:")
        password = input()
        cmd = ["stegpy", "-p",pic]
        subp = Popen([sys.executable, '-c', 'import pty, sys; pty.spawn(sys.argv[1:])', *cmd],stdin=PIPE,stdout=PIPE,stderr=PIPE)
        print(subp.stdout.read(len("Enter password (will not be echoed):")))
        subp.stdin.write(bytes((password+'\n').encode('utf-8')))
        subp.stdin.flush()
        print(subp.stdout.readlines())
        
        print('\n')
    elif choice == '3':
        file = open('password.txt', 'r')
        line = file.readline()
        while line:
            print(line)
            cmd = ["stegpy", "-p", pic]
            subp = Popen([sys.executable, '-c', 'import pty, sys; pty.spawn(sys.argv[1:])', *cmd], stdin=PIPE, stdout=PIPE,stderr=PIPE)
            print(subp.stdout.read(len("Enter password (will not be echoed):")))
            subp.stdin.write(bytes((line + '\n').encode('utf-8')))
            subp.stdin.flush()
            print('result:')
            result = subp.stdout.readlines()[1]
            print(result)
            if result != b'Wrong password.\r\n':
                break
            
            print('\n')
            line = file.readline()
    else :
        print('Input Wrong!')
if __name__ == "__main__":
    checkwebp('flag.png')
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44

hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)
后面的解析可以看:大佬

最后的flag:
flag{6330ae70-edd2-42d0-8309-f25a5868e65a}

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年8月28日22:53:43
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   hashcat破解KeePass,stegpy隐写爆破(美团CTF Boom)https://cn-sec.com/archives/3105137.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.