Four picture steganography title

first question

  • Open compressed get is a PNG format image

1538017412117

  • First, drag and drop 010Editor in:

1538017580794

CTRL + F search IHDR found only one, there are no other problems

  • Then analyzed in a wave into KALI:

Pictures can be opened in kali, the description is not the width and height of steganography, because if you modify the width and height is not display properly in linux

  • Then binwalk wave analysis:

The same is no problem

  • The final step is to try the inside into stegslove

Simple science knowledge about png

png support RGBA four channels, each accounting for 8 bits, steganographic file or data are generally low in each channel, because the changes do not cause a large low visual changes, the picture still looked the original picture, but you do not know in which channel, there are four channels, if hidden in a low channel, then there are four possible if hidden in the low two channels, it may carry out a variety of arithmetic operations after new pictures emerge , subtraction, multiplication and division with or XOR

I found Red plane 0 is empty, logically, it should also be "snow", so it should be a problem

Then Analyse - Data Extract, view the channel, that is the LSB Steganography

That is behind it Alpha, Red, Green, Blue 0 XORed channel will be able to get a flag, you can get by stegslove, said the following about a method of separating different color channels or processed by scripting python:

#代码参考自合天智汇
import cv2
import numpy as np
import os

def lowbit(x):

    return x & 0x1
png= cv2.imread("flag_enc.png" , cv2.IMREAD_UNCHANGED)

# 新建一个temp文件夹保存异或之后的图片
os.system("mkdir temp")
# 打开进入temp文件夹
os.system("cd temp")
for i in range(0,4):
    for f in range(0,4):
        dst= cv2.bitwise_xor(lowbit(png[: ,: ,i]),lowbit(png[: ,:, f]))
        cv2.imwrite("temp/"+"xor_"+str(i)+"_"+str(f)+".png",dst*255)
for i in range(0,4):
    for f in range(0,4):
        dst= cv2.bitwise_or(lowbit(png[: ,: ,i]),lowbit(png[: ,:, f]))
        cv2.imwrite("temp/"+"or_"+str(i)+"_"+str(f)+".png",dst*255)
for i in range(0,4):
    for f in range(0,4):
        dst= cv2.bitwise_and(lowbit(png[: ,: ,i]),lowbit(png[: ,:, f]))
        cv2.imwrite("temp/"+"and_"+str(i)+"_"+str(f)+".png",dst*255)

Then you can get the results, it is clear that the flag can be seen:

The second question

After downloading the archive decompression topic get two files desc.txt and damaged.disk

desc.txt bedding plane is a piece of English, the translation is:

Horse Clip-Clop
A strange filesystem is recovered from a damaged old hard disk.

Horses clip
from the old hard drive to restore the damaged strange file system.

Then Baidu, Google still can not understand, not analyzed this txt file


  • The damaged.disk drag 010Editor in to see what information

Beginning of the file, can not read. . . . . .

往下继续翻,CTRL+F 搜索一下 flag,key,ctf 无果(太天真了)

后面发现了PNG的文件头,终于找到关键信息

往下找发现有两个IHDR,CTRL +F 发现确实就是两个然后裁剪出来补上文件头得到两张图片

然后用PS将两张图片进行拼接,就得到flag了

第三题

下载得到一张图片,一贯的套路,拖到010Editor里面看看先

真正有东西的是后面的这部分数字和字母:

科普一下

Exif : 可交换图像文件格式(英语:Exchangeable image file format,官方简称Exif),是专门为数码相机的照片设定的,可以记录数码照片的属性信息和拍摄数据

Exif可以附加于JPEG、TIFF、RIFF 等文件之中,为其增加有关数码相机拍摄信息的内容和索引图或图像处理软件的版本信息。

还是binwalk分析一下看看:

没什么特别,看来flag就在这一串的数字字母结合的数据里头了,很明显看起来这是16进制的编码,Converter转换一下

得到的是一堆的坐标,然后通过坐标画图

方法一:使用KALI 的 gnuplot

百度略微了解了一下gnuplot的用法,把坐标转换成为 gnuplot 能够识别的形式,用notepad++ 的替换即可完成,保存为txt文件,然后在Kali中进入gnuplot,执行 plot "文件名",得到一张二维码:扫码即可得到falg:

flag{40fc0a979f759c8892f4dc045e28b820}

方法二:利用Python编写脚本

#代码参考自合天智汇
import cv2
import os
import numpy as np
n=0
canvas= np.ones((300, 300, 3), dtype="uint8")
canvas=canvas*255
list=open("1.txt").read().split("\n")
list=[i.split(",")for i in list]
for p in list:
    canvas[int(p[0]),int(p[1])]=[0,0,0]
    cv2.imwrite("2.jpg",canvas)
cv2.imshow("Canvas",canvas)
cv2.waitKey(0)

第四题

首先已经很明确的告诉了题目的相关信息

文件格式:BMP

工具:Winhex

类型:图片隐写

文件直接无法打开,到winhex中看一看

很显然这不是bmp文件头,所以这道题目就是加个头部就可以了,最后的答案是这样的,那么找一个bmp的文件头加上去嘛

加完之后,依旧是打不开的啊???难道是覆盖原来的地方么,那再试试吧!

还是打不开,看来是我想的太简单了。。。然后找资料详细了解一下bmp文件头

BMP文件分析

BMP(全称Bitmap)是Windows操作系统中的标准图像文件格式,可以分成两类:设备相关位图(DDB)和设备无关位图(DIB),使用非常广。它采用位映射存储格式,除了图像深度可选以外,不采用其他任何压缩,因此,BMP文件所占用的空间很大。

BMP文件的图像深度可选1bit、4bit、8bit、16bit、24bit、32bit。BMP文件存储数据时,图像的扫描方式是按从左到右、从下到上的顺序。由于BMP文件格式是Windows环境中交换与图有关的数据的一种标准,因此在Windows环境中运行的图形图像软件都支持BMP图像格式。

数据段名称 大小(byte)
bmp文件头 14
位图信息头 40
调色板 由颜色索引数决定
位图数据 由图像尺寸决定

图像通常保存的颜色深度有:wikipedia

  • 每像素1位:支持2种不同的颜色(例如:黑色和白色)像素值存储在每个位中,也即调色板有两个;
  • 每像素2位:支持4种不同的颜色,每1字节存储4个像;
  • 每像素4位:支持16种不同的颜色,每1字节存储2个像素;
  • 每像素8位:支持256种不同的颜色,每1字节存储1个像素;
  • 每像素16位:支持65536种不同的颜色,每2字节WORD存储1个像素;
  • 每像素24位:支持16,777,216种不同颜色(真彩色),每3字节存储1个像素值,没有调色板;
  • 每像素32位:支持4,294,967,296种不同颜色,每4字节DWORD存储1个像素,没有调色板;

BMP文件头

字节(byte) 内容 (HEX)
0-1(2byte) 4D 42(固定) 表示文件类型
2-5(4byte) 表示文件的大小
6-7(2byte) 00 00(固定)保留位
8-9(2byte) 00 00(固定)保留位
a-d(4byte) 4字节的偏移,表示从文件头到位图数据的偏移

位图信息头

字节 内容(HEX)
4byte 28 00 00 00(固定)信息头的大小
4byte 宽度(以像素为单位)
4byte Height (in pixels) and if positive, indicating that the inverted bit map (i.e., data representing an image from the lower left to upper right), if negative Description Positive;
2byte DESCRIPTION number of the target device color plane, is always set to 1
2byte The number of bits / pixel count, the decimal values ​​are 1,2,4,8,16,24,32
4byte DESCRIPTION pressure type of the bitmap data (00 00 00 00 no compression)
4byte DESCRIPTION bitmap data size, i.e. the size of the image file size = - Offset
4byte Horizontal resolution
4byte Vertical resolution
4byte Color index number

Palette

Do not have

topic

After analysis we found that not all of the bmp file header data is the same, so the need to know the size of the file, a brain can match the correct width header

  • Here you can see the file size is 230454 byte;
  • Image size is 230454-54 = 230400 byte;
  • High or so wide is how much?
    • Here depends on how much the bitmap is now common is 24, three bytes of storage per pixel
    • There is the end of the file to see 000 000 can also be learned that 24 of
    • Image size = W x H x 3
  • That is 320 x 240 x 3

Cover the file header to get the following picture:

Guess you like

Origin www.cnblogs.com/CH42e/p/11980516.html