This_is_not_a_standard_AES256

点击此处获得更好的阅读体验


WriteUp来源

https://xz.aliyun.com/t/6912

题目考点

解题思路

先nc获取信息

1
2
3
4
5
6
7
8
9
10
11
12
PS C:\Users\HiragaAya> nc 49.233.64.38 22333
This is you Sbox(tuple)
126, 143, 160, 15, 180, 170, 84, 152, 109, 20, 40, 136, 49, 179, 125, 165, 53, 251, 215, 87, 167, 41, 241, 178, 253, 239, 233, 193, 60, 110, 14, 246, 89, 228, 31, 42, 72, 213, 22, 102, 111, 52, 28, 254, 5, 219, 98, 94, 36, 161, 223, 191, 62, 57, 200, 133, 130, 149, 93, 248, 3, 13, 164, 76, 17, 101, 236, 51, 182, 81, 127, 185, 197, 100, 166, 183, 10, 18, 243, 196, 201, 119, 85, 131, 80, 46, 7, 224, 32, 158, 146, 71, 19, 25, 112, 249, 138, 139, 55, 175, 226, 1, 78, 106, 181, 211, 118, 218, 9, 64, 173, 207, 105, 63, 108, 235, 77, 134, 45, 44, 88, 171, 240, 65, 232, 33, 82, 227, 217, 129, 70, 8, 177, 128, 252, 135, 61, 190, 12, 150, 58, 216, 59, 121, 206, 188, 187, 104, 27, 242, 34, 212, 30, 176, 203, 244, 230, 141, 247, 114, 117, 0, 237, 39, 234, 21, 148, 2, 238, 250, 74, 4, 145, 29, 189, 192, 103, 229, 123, 163, 144, 153, 255, 154, 202, 86, 225, 195, 67, 37, 245, 43, 142, 221, 147, 209, 174, 97, 92, 231, 90, 107, 122, 56, 157, 35, 6, 156, 199, 120, 68, 116, 162, 79, 69, 198, 95, 38, 140, 169, 205, 204, 115, 210, 113, 23, 24, 132, 91, 73, 184, 172, 54, 159, 214, 47, 186, 208, 96, 66, 151, 83, 168, 99, 222, 26, 75, 124, 48, 137, 50, 155, 194, 16, 220, 11
----------------
This is you key(str)
letrvcgspwxjknzfylteavqbimszrwhk
----------------
This is you cipher(list)
93, 78, 25, 81, 18, 232, 250, 12, 94, 128, 81, 128, 88, 156, 180, 110, 151, 87, 197, 247, 8, 228, 51, 71, 102, 38, 146, 218, 40, 70, 6, 16
----------------
Enjoy it!
PS C:\Users\HiragaAya>

然后使用exp.py

1
2
3
4
5
6
7
8
9
import AES256,sbox
send = (126, 143, 160, 15, 180, 170, 84, 152, 109, 20, 40, 136, 49, 179, 125, 165, 53, 251, 215, 87, 167, 41, 241, 178, 253, 239, 233, 193, 60, 110, 14, 246, 89, 228, 31, 42, 72, 213, 22, 102, 111, 52, 28, 254, 5, 219, 98, 94, 36, 161, 223, 191, 62, 57, 200, 133, 130, 149, 93, 248, 3, 13, 164, 76, 17, 101, 236, 51, 182, 81, 127, 185, 197, 100, 166, 183, 10, 18, 243, 196, 201, 119, 85, 131, 80, 46, 7, 224, 32, 158, 146, 71, 19, 25, 112, 249, 138, 139, 55, 175, 226, 1, 78, 106, 181, 211, 118, 218, 9, 64, 173, 207, 105, 63, 108, 235, 77, 134, 45, 44, 88, 171, 240, 65, 232, 33, 82, 227, 217, 129, 70, 8, 177, 128, 252, 135, 61, 190, 12, 150, 58, 216, 59, 121, 206, 188, 187, 104, 27, 242, 34, 212, 30, 176, 203, 244, 230, 141, 247, 114, 117, 0, 237, 39, 234, 21, 148, 2, 238, 250, 74, 4, 145, 29, 189, 192, 103, 229, 123, 163, 144, 153, 255, 154, 202, 86, 225, 195, 67, 37, 245, 43, 142, 221, 147, 209, 174, 97, 92, 231, 90, 107, 122, 56, 157, 35, 6, 156, 199, 120, 68, 116, 162, 79, 69, 198, 95, 38, 140, 169, 205, 204, 115, 210, 113, 23, 24, 132, 91, 73, 184, 172, 54, 159, 214, 47, 186, 208, 96, 66, 151, 83, 168, 99, 222, 26, 75, 124, 48, 137, 50, 155, 194, 16, 220, 11)
invsbox = sbox.InvSbox(send)
print (invsbox)
cipher = [93, 78, 25, 81, 18, 232, 250, 12, 94, 128, 81, 128, 88, 156, 180, 110, 151, 87, 197, 247, 8, 228, 51, 71, 102, 38, 146, 218, 40, 70, 6, 16]
key = "letrvcgspwxjknzfylteavqbimszrwhk"
plain = AES256.decrypt(cipher,key,"ECB","")

AES256.plain_to_ascii(plain)

运行得到逆S盒

1
2
161, 101, 167, 60, 171, 44, 206, 86, 131, 108, 76, 255, 138, 61, 30, 3, 253, 64, 77, 92, 9, 165, 38, 225, 226, 93, 245, 148, 42, 173, 152, 34, 88, 125, 150, 205, 48, 189, 217, 163, 10, 21, 35, 191, 119, 118, 85, 235, 248, 12, 250, 67, 41, 16, 232, 98, 203, 53, 140, 142, 28, 136, 52, 113, 109, 123, 239, 188, 210, 214, 130, 91, 36, 229, 170, 246, 63, 116, 102, 213, 84, 69, 126, 241, 6, 82, 185, 19, 120, 32, 200, 228, 198, 58, 47, 216, 238, 197, 46, 
243, 73, 65, 39, 176, 147, 112, 103, 201, 114, 8, 29, 40, 94, 224, 159, 222, 211, 160, 106, 81, 209, 143, 202, 178, 247, 14, 0, 70, 133, 129, 56, 83, 227, 55, 117, 135, 11, 249, 96, 97, 218, 157, 192, 1, 180, 172, 90, 194, 166, 57, 139, 240, 7, 181, 183, 251, 207, 204, 89, 233, 2, 49, 212, 179, 62, 15, 74, 20, 242, 219, 5, 121, 231, 110, 196, 99, 153, 132, 23, 13, 4, 104, 68, 75, 230, 71, 236, 146, 145, 174, 137, 51, 175, 27, 252, 187, 79, 72, 215, 208, 54, 80, 184, 154, 221, 220, 144, 111, 237, 195, 223, 105, 151, 37, 234, 18, 141, 128, 107, 45, 254, 193, 244, 50, 87, 186, 100, 127, 33, 177, 156, 199, 124, 26, 164, 115, 66, 162, 168, 25, 122, 22, 149, 78, 155, 190, 31, 158, 59, 95, 169, 17, 134, 24, 43, 182

填入AES256.py的前面

1
2
3
4
(161, 101, 167, 60, 171, 44, 206, 86, 131, 108, 76, 255, 138, 61, 30, 3, 253, 64, 77, 92, 9, 165, 38, 225, 226, 93, 245, 148, 42, 173, 152, 34, 88, 125, 150, 205, 48, 189, 217, 163, 10, 21, 35, 191, 119, 118, 85, 235, 248, 12, 250, 67, 41, 16, 232, 98, 203, 53, 140, 142, 28, 136, 52, 113, 109, 123, 239, 188, 210, 214, 130, 91, 36, 229, 170, 246, 63, 116, 102, 213, 84, 69, 126, 241, 6, 82, 185, 19, 120, 32, 200, 228, 198, 58, 47, 216, 238, 197, 46, 
243, 73, 65, 39, 176, 147, 112, 103, 201, 114, 8, 29, 40, 94, 224, 159, 222, 211, 160, 106, 81, 209, 143, 202, 178, 247, 14, 0, 70, 133, 129, 56, 83, 227, 55, 117, 135, 11, 249, 96, 97, 218, 157, 192, 1, 180, 172, 90, 194, 166, 57, 139, 240, 7, 181, 183, 251, 207, 204, 89, 233, 2, 49, 212, 179, 62, 15, 74, 20, 242, 219, 5, 121, 231, 110, 196, 99, 153, 132, 23, 13, 4, 104, 68, 75, 230, 71, 236, 146, 145, 174, 137, 51, 175, 27, 252, 187, 79, 72, 215, 208, 54, 80, 184, 154, 221, 220, 144, 111, 237, 195, 223, 105, 151, 37, 234, 18, 141, 128, 107, 45, 254, 193, 244, 50, 87, 186, 100, 127, 33, 177, 156, 199, 124, 26, 164, 115, 66, 162, 168, 25, 122, 22, 149, 78, 155, 190, 31, 158, 59, 95, 169, 17, 134, 24, 43, 182)
flag{sbox_to_invsbox}
PS C:\Users\HiragaAya>

Flag

1
flag{sbox_to_invsbox}