bigrsa

题目:

from Crypto.Util.number import *
from flag import * n1 = 103835296409081751860770535514746586815395898427260334325680313648369132661057840680823295512236948953370895568419721331170834557812541468309298819497267746892814583806423027167382825479157951365823085639078738847647634406841331307035593810712914545347201619004253602692127370265833092082543067153606828049061
n2 = 115383198584677147487556014336448310721853841168758012445634182814180314480501828927160071015197089456042472185850893847370481817325868824076245290735749717384769661698895000176441497242371873981353689607711146852891551491168528799814311992471449640014501858763495472267168224015665906627382490565507927272073
e = 65537
m = bytes_to_long(flag)
c = pow(m, e, n1)
c = pow(c, e, n2) print("c = %d" % c) # output
# c = 60406168302768860804211220055708551816238816061772464557956985699400782163597251861675967909246187833328847989530950308053492202064477410641014045601986036822451416365957817685047102703301347664879870026582087365822433436251615243854347490600004857861059245403674349457345319269266645006969222744554974358264

思路:没什么好说的,因为给了两个n,所以可以考虑找两个n的公因数来分解n

RingRingRing

题目:

这是一个与密码系统交互的题,流程大概就是先是一个hash验证,然后要求输入100轮的a、b、c、d、e,满足\(a^4+b^4+c^4+d^4=e^2\),但是它没有要求abcd不能一样,只要求了不能输入0和不能重复,所以可以将a,b,c,d当做同一个值来看待,于是就有了\(4a^4=e^2\),\(2a^2=e\)的情况,当然100轮输入,自己手打肯定是不行的(我自己最高也就手打到65轮),所以要写个脚本来交互

由于需要交互,所以需要python中的pwntools这个扩展包来搞定。

下面是几个脚本的汇总(看着别人的脚本,感觉自己写的简直……)

#我自己写的,勉强能用
from pwn import *
import hashlib
#context.log_level = "debug"
sock = remote('192.168.40.249',2378)
back1=sock.recvline()
print(back1) #打印返回值
md5send=b'0'
a1=back1[36:40]
a2=back1[50:55]
b1=str(a1)[2:-1]
b2=str(a2)[2:-1]
print(b1)
print(b2)
for i in range(10000000):
if hashlib.md5((str(i) + b1).encode("utf-8")).hexdigest()[0:5] == b2:
md5send=str(i)
break
sock.sendline(md5send)
print(sock.recvline())
for i in range(1,101):
print(i)
sock.recv(1024)
sock.send(str(i))
sock.recv(1024)
sock.send(str(i))
sock.recv(1024)
sock.send(str(i))
sock.recv(1024)
sock.send(str(i))
sock.recv(1024)
sock.send(str(2*(i**2)))
print(sock.recvline())
#某个大佬给我的
import hashlib
from pwn import * def r_md5(s1, s2):
for i in range(10000000):
if hashlib.md5((str(i) + s1).encode("utf-8")).hexdigest()[0:5] == s2:
return str(i) res = [[1,2],[2,8],[3,18],[4,32],[5,50],[6,72],[7,98],[8,128],[9,162],[10,200],[11,242],[12,288],[13,338],[14,392],[15,450],[16,512],[17,578],[18,648],[19,722],[20,800],[21,882],[22,968],[23,1058],[24,1152],[25,1250],[26,1352],[27,1458],[28,1568],[29,1682],[30,1800],[31,1922],[32,2048],[33,2178],[34,2312],[35,2450],[36,2592],[37,2738],[38,2888],[39,3042],[40,3200],[41,3362],[42,3528],[43,3698],[44,3872],[45,4050],[46,4232],[47,4418],[48,4608],[49,4802],[50,5000],[51,5202],[52,5408],[53,5618],[54,5832],[55,6050],[56,6272],[57,6498],[58,6728],[59,6962],[60,7200],[61,7442],[62,7688],[63,7938],[64,8192],[65,8450],[66,8712],[67,8978],[68,9248],[69,9522],[70,9800],[71,10082],[72,10368],[73,10658],[74,10952],[75,11250],[76,11552],[77,11858],[78,12168],[79,12482],[80,12800],[81,13122],[82,13448],[83,13778],[84,14112],[85,14450],[86,14792],[87,15138],[88,15488],[89,15842],[90,16200],[91,16562],[92,16928],[93,17298],[94,17672],[95,18050],[96,18432],[97,18818],[98,19208],[99,19602],[100,20000]]
if __name__ == "__main__":
#context.log_level = "debug"
p = remote('192.168.40.249', 2378)
s = str(p.recvline())
s1, s2 = s[38:42], s[52:57]
xxxxx = r_md5(s1,s2)
print(xxxxx)
p.recv(1024)
p.sendline(xxxxx)
p.recvline()
p.recvline()
for i in range(100):
p.recv(1024)
p.sendline(str(res[i][0]))
p.recv(1024)
p.sendline(str(res[i][0]))
p.recv(1024)
p.sendline(str(res[i][0]))
p.recv(1024)
p.sendline(str(res[i][0]))
p.recv(1024)
p.sendline(str(res[i][1]))
p.recvline()
p.recvline()
p.recvline()
p.recvline()
# 商业转载请联系作者获得授权,非商业转载请注明出处。
# For commercial use, please contact the author for authorization. For non-commercial use, please indicate the source.
# 协议(License):署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
# 作者(Author):
# 链接(URL):https://www.wkr.moe/ctf/562.html
# 来源(Source): from hashlib import md5
from string import digits, ascii_lowercase
from pwn import connect def go(strend, hashstart):
hexdigits = digits+ascii_lowercase[0:6]
for i in hexdigits:
for j in hexdigits:
for k in hexdigits:
for l in hexdigits:
for m in hexdigits:
for n in hexdigits:
str = i + j + k + l + m + n
if md5(f'{str}{strend}'.encode()).hexdigest()[0:5] == hashstart:
return str if __name__ == '__main__':
conn = connect('192.168.39.181', 2378)
prevQ = conn.recvuntil(b'[>] Give me xxxxx: ')
print(prevQ[36:40].decode(), prevQ[50:55].decode())
prevA = go(prevQ[36:40].decode(), prevQ[50:55].decode())
conn.sendline(prevA.encode())
print(conn.recvlines(2))
for _ in range(1, 101):
for __ in range(4):
#输入一样的abcd
print(conn.recvn(7))
conn.send(str(_).encode())
#输入不一样的e
print(conn.recvn(7))
conn.send(str((_ ** 2) * 2).encode())
#接收每一轮返回的‘You are right’
print(conn.recvlines(1))
print(conn.recvlines(1)) # flag
conn.close()

最后一个脚本的来源

RSA?

题目:

import os
from Crypto.Util.number import * flag = "GWHT{xxxxxxxxx}"
p = getPrime(256)
q = getPrime(256)
n = p*q
N = (p-1)*(q-1)
e = 65537
Mx = bytes_to_long(os.urandom(30))
My = bytes_to_long(flag)
Z1 = (Mx*My)%n
inv_Z1 = inverse_mod(Z1, n)
inv_2 = inverse_mod(2, n)
X = ((Z1+inv_Z1)*inv_2)%n
Y = My
inv_Y = inverse_mod(Y, n)
a = ((inv_Z1-X)*inv_Y)%n
D = (a*a)%n xy = lambda (x1,y1),(x2,y2) : ((x1*x2+D*y1*y2)%n, (x1*y2+x2*y1)%n)
def getloop((x,y), e):
ret = (x, y)
for i in range(e-1):
ret = xy(ret, (x,y))
return ret print n
print getloop((X, Y), e)
print a # 13390709926509813526471364597371124446888078365567927211781799241724742352679484983709219580483800891886832613684875066109177882219522305348565532970795023
# (5404548088049249951619519701935576492239293254135836357417714329205323074367876875480850741613547220698045360461761929952847796420174204143917852624050110, 2110372753170830610718226848526649992911771424441223687775304654852191999130502986109306355582366065947895295520226816523397652918227241733632791793362785)
# 1762039418842677123086894939949574689744108610561557889235294034870342076452734215004689409493802437034960516295735815195656138656970901855976802991519141

过程:

略过前面的RSA参数赋值,开始看:

Mx = bytes_to_long(os.urandom(30))

My = bytes_to_long(flag)

Z1 = (Mx*My)%n

inv_Z1 = inverse_mod(Z1, n)

inv_2 = inverse_mod(2, n)

Mx和My分别是随机生成的大小(长度)为30的字符串和flag对应的长整数,用数学公式表示为:

\[inv\_Z_1=\frac{1}{Z_1}\\
inv\_2=\frac{1}{2}
\]

X = ((Z1+inv_Z1)*inv_2)%n

Y = My

inv_Y = inverse_mod(Y, n)

表示为:

\[\begin{equation}
\begin{aligned}
X&=(Z_1+\frac{1}{Z_1})*\frac{1}{2}\ mod\ n \\
&=(M_XM_y+\frac{1}{M_xM_y})*\frac{1}{2}\ mod\ n \\
&=\frac{1+M_x^2M_y^2}{2M_xM_y} \\
Y&=M_y \\
in&v\_Y=\frac{1}{M_y}
\end{aligned}
\end{equation}
\]

a = ((inv_Z1-X)inv_Y)%n

D = (a
a)%n

\[\begin{equation}
\begin{aligned}
a&=((\frac{1}{Z_1}-X)*\frac{1}{Y})\ mod\ n \\
&=((\frac{2-1-M_x^2M_y^2}{2M_xM_y})*\frac{1}{M_y})\ mod\ n \\
&=\frac{1-M_x^2M_y^2}{2M_xM_y^2}\ mod\ n \\
D&=\frac{(1-M_x^2M_y^2)^2}{4M_x^2M_y^4}\ mod\ n
\end{aligned}
\end{equation}
\]

xy = lambda (x1,y1),(x2,y2) : ((x1x2+Dy1y2)%n, (x1y2+x2*y1)%n)

def getloop((x,y), e):

ret = (x, y)

for i in range(e-1):

ret = xy(ret, (x,y))

return ret

这段代码是非常难顶的,因为它看起来好大,当时做题的时候我看了看,感觉好像会很长,下意识的认为这个没办法列出来具体的数学公式,而且它看起来类似分组密码。

公式如下:

\[\begin{equation}
\begin{aligned}
&n=0,X_0=X=\frac{1+M_x^2M_y^2}{2M_xM_y},Y_0=M_y \\
&n=1,X_1=\frac{1+M_x^4M_y^4}{2M_x^2M_y^2},Y_1=\frac{1+M_x^2M_y^2}{M_x} \\
&n=2,X_2=\frac{1+M_x^6M_y^6}{2M_x^3M_y^3},Y_2=\frac{1+M_x^2M_y^2+M_x^4M_y^4}{M_x^2M_y}
\end{aligned}
\end{equation}
\]

所以,以此类推,可得:

\[X_n=\frac{1+M_x^{2n+2}M_y^{2n+2}}{2M_x^{n+1}M_y^{n+1}},Y_n=\frac{\sum_{i=0}^{n}M_x^{2n}M_y^{2n}}{M_x^nM_y^{n-1}}
\]

然后则是关键点:要用Yn乘a来完成Yn与Xn之间的联系:

\[\begin{equation}
\begin{aligned}
Y_n*a&=\frac{\sum_{i=0}^{n}M_x^{2n}M_y^{2n}}{M_x^nM_y^{n-1}}*\frac{1-M_x^2M_y^2}{2M_xM_y^2} \\
&=\frac{1-M_x^{2n+2}M_y^{2n+2}}{2M_x^{n+1}M_y^{n+1}} \\
&=X_n-\frac{2M_x^{2n+2}M_y^{2n+2}}{2M_x^{n+1}M_y^{n+1}} \\
&=X_n-M_x^{n+1}M_y^{n+1}(注意这里不是X_n-M_x^{2}M_y^{2})
\end{aligned}
\end{equation}
\]

又因为\(Y_n、X_n、a\)三个量是已知的,所以可以求得\(M_x^{n+1}M_y^{n+1}\)的值(这里的n是e-1)也就是\((M_xM_y)^e(mod\ n)\),而这个形式也是RSA加密的形式,那么需要找到e在模n的逆元d。这道题并没有给出关于n的分解的提示,那么尝试用yafu分解,可以得到:

fac: factoring 13390709926509813526471364597371124446888078365567927211781799241724742352679484983709219580483800891886832613684875066109177882219522305348565532970795023

fac: using pretesting plan: normal

fac: no tune info: using qs/gnfs crossover of 95 digits

div: primes less than 10000

fmt: 1000000 iterations

Total factoring time = 0.1120 seconds

factors found

P78 = 115718235064789220654263009993128325569382592506655305434488398268608329541037

P78 = 115718235064789220654263009993128324769382192706654302434478391267607309966379

ans = 1

到了这一步以后,就会发现解出来是\(M_xM_y\),而flag是\(M_y\),那么可以找一找公式中\(M_x/M_y\)不是齐次的有a和D(其实这两个等价)又因为给出了a的值,所以a和D都可以来求出\(M_y\):

\[\begin{equation}
\begin{aligned}
a&=\frac{1-M_x^2M_y^2}{2M_xM_y^2} \\
M_y&=\frac{1-(M_xM_y)^2}{2aM_xM_y}
\end{aligned}
\end{equation}
\]

脚本:

from Crypto.Util.number import long_to_bytes
from gmpy2 import invert
p=115718235064789220654263009993128324769382192706654302434478391267607309966379
q=115718235064789220654263009993128325569382592506655305434488398268608329541037
n=p*q
X_n=5404548088049249951619519701935576492239293254135836357417714329205323074367876875480850741613547220698045360461761929952847796420174204143917852624050110
Y_n=2110372753170830610718226848526649992911771424441223687775304654852191999130502986109306355582366065947895295520226816523397652918227241733632791793362785
a=1762039418842677123086894939949574689744108610561557889235294034870342076452734215004689409493802437034960516295735815195656138656970901855976802991519141
e=65537
d=invert(e,(p-1)*(q-1))
MXMY=pow((X_n-Y_n*a)%n,d,p*q)
MY=(1-MXMY**2)*invert(2,n)*invert(MXMY,n)*invert(a,n) %n
#这里一定要有一个模n的操作,不然会得到一个负数,并且这里也不能直接除以2*a*MXMY,一定得是它们的模n的逆元
print(long_to_bytes(MY))

GWHT{pell_equation_is_very_interesting}

今天看博客,发现有一个wp里面说这个方程很像Pell方程,可以参考这篇文章:佩尔(Pell)方程,而这篇论文A PUBLIC KEY CRYPTOSYSTEM BASED ON PELL EQUATION则讲述了一个基于Pell方程的公钥密码系统,可以拿来参考一下~

easy_rsa

easyrsa就从来都没有easy过……

题目:

from Crypto.Util.number import *
from flag import flag
import gmpy2 def gen_prime(nbits, gamma):
g = getPrime(int(nbits * gamma)) #491
alpha = 0.5 - gamma #0.02
while True:
a = getRandomNBitInteger(int(alpha * nbits)) #20
p = 2 * g * a + 1
if isPrime(p):
b = getRandomNBitInteger(int(alpha * nbits))
q = 2 * g * b + 1
h = 2 * g * a * b + a + b
while not isPrime(q) or isPrime(h) or gmpy2.gcd(a, b) != 1: #保证q是素数,h不是素数,a、b没有公约数
b = getRandomNBitInteger(int(alpha * nbits))
q = 2 * g * b + 1
return p, q def encrypt(nbits, gamma):
p, q = gen_prime(nbits, gamma)
n = p * q
e = getPrime(16)
while gmpy2.gcd(e, gmpy2.lcm(p-1,q-1)) != 1:
e = getPrime(16)
m = bytes_to_long(flag)
c = pow(m, e, n)
return n, e, c n, e, c = encrypt(1024, 0.48)
print 'n =', n
print 'e =', e
print 'c =', c # n = 84236796025318186855187782611491334781897277899439717384242559751095347166978304126358295609924321812851255222430530001043539925782811895605398187299748256080526691975084042025794113521587064616352833904856626744098904922117855866813505228134381046907659080078950018430266048447119221001098505107823645953039
# e = 58337
# c = 13646200911032594651110040891135783560995665642049282201695300382255436792102048169200570930229947213493204600006876822744757042959653203573780257603577712302687497959686258542388622714078571068849217323703865310256200818493894194213812410547780002879351619924848073893321472704218227047519748394961963394668

这道题的解法主要在于Pollard's rho algorithm的修改应用,具体的参考来源为:RSA - Large Common Factor of p-1 and q-1,但可惜的是我并不知道里面的原理……大佬写的太简略了啊~

结论反正就是用\(x^{N-1}+3\)来代替rho中的迭代函数,能在比较短的时间里分解N

拿大佬的脚本修改后就可以得到解题脚本:

from Crypto.Util.number import *
from gmpy2 import invert def f(x, n):
return (pow(x, n - 1, n) + 3) % n def rho(n):
i = 1
while True:
a = getRandomRange(2, n)
b = f(a, n)
j = 1
while True:
p = GCD(abs(a - b), n)
print('{} in {} circle'.format(j, i))
if p == n:
break
elif p > 1:
return (p, n // p)
else:
a = f(a, n)
b = f(f(b, n), n)
j += 1
i += 1 n = 84236796025318186855187782611491334781897277899439717384242559751095347166978304126358295609924321812851255222430530001043539925782811895605398187299748256080526691975084042025794113521587064616352833904856626744098904922117855866813505228134381046907659080078950018430266048447119221001098505107823645953039
c=13646200911032594651110040891135783560995665642049282201695300382255436792102048169200570930229947213493204600006876822744757042959653203573780257603577712302687497959686258542388622714078571068849217323703865310256200818493894194213812410547780002879351619924848073893321472704218227047519748394961963394668
e=58337 p,q=rho(n)
d=invert(e,(p-1)*(q-1))
print(long_to_bytes(pow(c,d,n)))

b'SangFor{0a8c2220-4c1b-32c8-e8c1-adf92ec7678b}'

miss

题目:

簜9%k? 櫌mO

题目脚本:

#!/usr/bin/env python3

from Crypto import Random

S_BOX = [
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
0xcd, 0x0c, 0x13, 0xec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0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d] GF_MULT_1 = [
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,
0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,
0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,
0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f,
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,
0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,
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,0x97,0x94,0x91,0x92,0x83,0x80,0x85,0x86,0x8f,0x8c,0x89,0x8a,
0xab,0xa8,0xad,0xae,0xa7,0xa4,0xa1,0xa2,0xb3,0xb0,0xb5,0xb6,0xbf,0xbc,0xb9,0xba,
0xfb,0xf8,0xfd,0xfe,0xf7,0xf4,0xf1,0xf2,0xe3,0xe0,0xe5,0xe6,0xef,0xec,0xe9,0xea,
0xcb,0xc8,0xcd,0xce,0xc7,0xc4,0xc1,0xc2,0xd3,0xd0,0xd5,0xd6,0xdf,0xdc,0xd9,0xda,
0x5b,0x58,0x5d,0x5e,0x57,0x54,0x51,0x52,0x43,0x40,0x45,0x46,0x4f,0x4c,0x49,0x4a,
0x6b,0x68,0x6d,0x6e,0x67,0x64,0x61,0x62,0x73,0x70,0x75,0x76,0x7f,0x7c,0x79,0x7a,
0x3b,0x38,0x3d,0x3e,0x37,0x34,0x31,0x32,0x23,0x20,0x25,0x26,0x2f,0x2c,0x29,0x2a,
0x0b,0x08,0x0d,0x0e,0x07,0x04,0x01,0x02,0x13,0x10,0x15,0x16,0x1f,0x1c,0x19,0x1a] def rotWord(byteArray):
res = bytearray() res.append(byteArray[1])
res.append(byteArray[2])
res.append(byteArray[3])
res.append(byteArray[0]) return res def subWord(byteArray):
res = bytearray() for b in byteArray:
res.append( S_BOX[b] ) return res def rcon(i):
res = bytearray() res.append(RCON_BOX[i])
res.append(0)
res.append(0)
res.append(0) return res def xor(byteArray1, byteArray2):
res = bytearray() for b1, b2 in zip(byteArray1, byteArray2):
res.append(b1 ^ b2) return res def keyExpansion(key,round): lastcolumn = key[-4:] resRcon = rotWord(lastcolumn) resSub = subWord(resRcon) res1XOR = xor(resSub,key[:4]) newFirstColumn = xor(res1XOR,rcon(round)) newKey = newFirstColumn for i in range(1,4):
part1XOR = newKey[-4:]
part2XOR = key[i*4:(i+1)*4]
newKey += xor(part1XOR, part2XOR) return newKey def subBytes(aesState):
resState = bytearray() for i in range(0,len(aesState),4):
resState[i:i+4] = subWord(aesState[i:i+4]) return resState def shiftRow(aesState): resState = bytearray() newPosition = [ 0, 5, 0xa, 0xf,4, 9, 0xe, 3,8, 0xd, 2, 7, 0xc, 1, 6, 0xb ] for i in newPosition:
resState.append(aesState[i]) return resState def mixColumn(aesState): res = bytearray() for i in range(0,len(aesState),4):
b0, b1, b2, b3 = aesState[i:i+4] new_b0 = GF_MULT_2[b0] ^ GF_MULT_3[b1] ^ GF_MULT_1[b2] ^ GF_MULT_1[b3]
new_b1 = GF_MULT_1[b0] ^ GF_MULT_2[b1] ^ GF_MULT_3[b2] ^ GF_MULT_1[b3]
new_b2 = GF_MULT_1[b0] ^ GF_MULT_1[b1] ^ GF_MULT_2[b2] ^ GF_MULT_3[b3]
new_b3 = GF_MULT_3[b0] ^ GF_MULT_1[b1] ^ GF_MULT_1[b2] ^ GF_MULT_2[b3] res.append(new_b0)
res.append(new_b1)
res.append(new_b2)
res.append(new_b3) return res def AES_Encryption(plainText, AES_key, nbRound): res = bytearray()
plainTextBytes = plainText KeyList = [AES_key] for i in range(1, nbRound+1):
KeyList.append(keyExpansion(KeyList[-1],i)) res = plainTextBytes for i in range(1,nbRound): res = subBytes(res) res = shiftRow(res) res = mixColumn(res) key = KeyList[i] res = subBytes(res)
res = shiftRow(res) return res def StringToByteArray(msg):
return [ord(x) for x in msg] def ByteArrayToString(cipher):
return ''.join([chr(x) for x in cipher]) def main(): AES_Key = Random.get_random_bytes(16) with open("flag.txt","rb") as f_in:
flag = f_in.read() cipherText = AES_Encryption(flag, AES_Key,10) with open("cipher.txt","wb") as f_out:
f_out.write(cipherText) if __name__ == '__main__':
main()

解题脚本:

# -*- coding: utf-8 -*-
"""
Created on Tue Sep 14 23:19:19 2021 @author: 01am
""" S_BOX = [
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0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0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d] GF_MULT_1 = [
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,
0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,
0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,
0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f,
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,
0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,
0xd0,0xd1,0xd2,0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,0x83,0x80,0x85,0x86,0x8f,0x8c,0x89,0x8a,
0xab,0xa8,0xad,0xae,0xa7,0xa4,0xa1,0xa2,0xb3,0xb0,0xb5,0xb6,0xbf,0xbc,0xb9,0xba,
0xfb,0xf8,0xfd,0xfe,0xf7,0xf4,0xf1,0xf2,0xe3,0xe0,0xe5,0xe6,0xef,0xec,0xe9,0xea,
0xcb,0xc8,0xcd,0xce,0xc7,0xc4,0xc1,0xc2,0xd3,0xd0,0xd5,0xd6,0xdf,0xdc,0xd9,0xda,
0x5b,0x58,0x5d,0x5e,0x57,0x54,0x51,0x52,0x43,0x40,0x45,0x46,0x4f,0x4c,0x49,0x4a,
0x6b,0x68,0x6d,0x6e,0x67,0x64,0x61,0x62,0x73,0x70,0x75,0x76,0x7f,0x7c,0x79,0x7a,
0x3b,0x38,0x3d,0x3e,0x37,0x34,0x31,0x32,0x23,0x20,0x25,0x26,0x2f,0x2c,0x29,0x2a,
0x0b,0x08,0x0d,0x0e,0x07,0x04,0x01,0x02,0x13,0x10,0x15,0x16,0x1f,0x1c,0x19,0x1a] GF_MULT_09 = [
0x00,0x09,0x12,0x1b,0x24,0x2d,0x36,0x3f,0x48,0x41,0x5a,0x53,0x6c,0x65,0x7e,0x77,
0x90,0x99,0x82,0x8b,0xb4,0xbd,0xa6,0xaf,0xd8,0xd1,0xca,0xc3,0xfc,0xf5,0xee,0xe7,
0x3b,0x32,0x29,0x20,0x1f,0x16,0x0d,0x04,0x73,0x7a,0x61,0x68,0x57,0x5e,0x45,0x4c,
0xab,0xa2,0xb9,0xb0,0x8f,0x86,0x9d,0x94,0xe3,0xea,0xf1,0xf8,0xc7,0xce,0xd5,0xdc,
0x76,0x7f,0x64,0x6d,0x52,0x5b,0x40,0x49,0x3e,0x37,0x2c,0x25,0x1a,0x13,0x08,0x01,
0xe6,0xef,0xf4,0xfd,0xc2,0xcb,0xd0,0xd9,0xae,0xa7,0xbc,0xb5,0x8a,0x83,0x98,0x91,
0x4d,0x44,0x5f,0x56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,0xa2,
0xf6,0xfd,0xe0,0xeb,0xda,0xd1,0xcc,0xc7,0xae,0xa5,0xb8,0xb3,0x82,0x89,0x94,0x9f,
0x46,0x4d,0x50,0x5b,0x6a,0x61,0x7c,0x77,0x1e,0x15,0x08,0x03,0x32,0x39,0x24,0x2f,
0x8d,0x86,0x9b,0x90,0xa1,0xaa,0xb7,0xbc,0xd5,0xde,0xc3,0xc8,0xf9,0xf2,0xef,0xe4,
0x3d,0x36,0x2b,0x20,0x11,0x1a,0x07,0x0c,0x65,0x6e,0x73,0x78,0x49,0x42,0x5f,0x54,
0xf7,0xfc,0xe1,0xea,0xdb,0xd0,0xcd,0xc6,0xaf,0xa4,0xb9,0xb2,0x83,0x88,0x95,0x9e,
0x47,0x4c,0x51,0x5a,0x6b,0x60,0x7d,0x76,0x1f,0x14,0x09,0x02,0x33,0x38,0x25,0x2e,
0x8c,0x87,0x9a,0x91,0xa0,0xab,0xb6,0xbd,0xd4,0xdf,0xc2,0xc9,0xf8,0xf3,0xee,0xe5,
0x3c,0x37,0x2a,0x21,0x10,0x1b,0x06,0x0d,0x64,0x6f,0x72,0x79,0x48,0x43,0x5e,0x55,
0x01,0x0a,0x17,0x1c,0x2d,0x26,0x3b,0x30,0x59,0x52,0x4f,0x44,0x75,0x7e,0x63,0x68,
0xb1,0xba,0xa7,0xac,0x9d,0x96,0x8b,0x80,0xe9,0xe2,0xff,0xf4,0xc5,0xce,0xd3,0xd8,
0x7a,0x71,0x6c,0x67,0x56,0x5d,0x40,0x4b,0x22,0x29,0x34,0x3f,0x0e,0x05,0x18,0x13,
0xca,0xc1,0xdc,0xd7,0xe6,0xed,0xf0,0xfb,0x92,0x99,0x84,0x8f,0xbe,0xb5,0xa8,0xa3] GF_MULT_13 = [
0x00,0x0d,0x1a,0x17,0x34,0x39,0x2e,0x23,0x68,0x65,0x72,0x7f,0x5c,0x51,0x46,0x4b,
0xd0,0xdd,0xca,0xc7,0xe4,0xe9,0xfe,0xf3,0xb8,0xb5,0x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,0x34,0x3a,0x28,0x26,0x7c,0x72,0x60,0x6e,0x44,0x4a,0x58,0x56,
0x37,0x39,0x2b,0x25,0x0f,0x01,0x13,0x1d,0x47,0x49,0x5b,0x55,0x7f,0x71,0x63,0x6d,
0xd7,0xd9,0xcb,0xc5,0xef,0xe1,0xf3,0xfd,0xa7,0xa9,0xbb,0xb5,0x9f,0x91,0x83,0x8d] def inv_subWord(byteArray):
res = bytearray() for b in byteArray:
res.append( S_INV_BOX[b] ) return res def inv_subBytes(aesState):
resState = bytearray() for i in range(0,len(aesState),4):
resState[i:i+4] = inv_subWord(aesState[i:i+4]) return resState def inv_shiftRow(aesState):
resState = bytearray() """
0 4 8 c 0 4 8 c
1 5 9 d d 1 5 9
2 6 a e -> a e 2 6
3 7 b f 7 b f 3
""" newPosition = [ 0, 0xd, 0xa, 7,
4, 1, 0xe, 0xb,
8, 5, 2, 0xf,
0xc, 9, 6, 3
] for i in newPosition:
resState.append(aesState[i]) return resState def inv_mixColumn(aesState): res = bytearray() for i in range(0,len(aesState),4):
b0, b1, b2, b3 = aesState[i:(i+4)] new_b0 = GF_MULT_14[b0] ^ GF_MULT_11[b1] ^ GF_MULT_13[b2] ^ GF_MULT_09[b3]
new_b1 = GF_MULT_09[b0] ^ GF_MULT_14[b1] ^ GF_MULT_11[b2] ^ GF_MULT_13[b3]
new_b2 = GF_MULT_13[b0] ^ GF_MULT_09[b1] ^ GF_MULT_14[b2] ^ GF_MULT_11[b3]
new_b3 = GF_MULT_11[b0] ^ GF_MULT_13[b1] ^ GF_MULT_09[b2] ^ GF_MULT_14[b3] res.append(new_b0)
res.append(new_b1)
res.append(new_b2)
res.append(new_b3) return res def AES_Decryption(cipherText, AES_key, nbRound): res = cipherText res = inv_shiftRow(res) res = inv_subBytes(res) for i in range(nbRound-1, 0, -1): res = inv_mixColumn(res) res = inv_shiftRow(res) res = inv_subBytes(res) return res def main(): AES_Key = None with open(r"D:\code\ctf题目\Crypto\2021羊城杯\miss\miss-59d0d460-aa0d-45a8-b6e7-14b1b32b8a59\cipher.txt","rb") as f_in:
cipherText = f_in.read() secondPlainText = AES_Decryption(cipherText, AES_Key,10) print(secondPlainText) if __name__ == '__main__':
main()

脚本只要把最后的main函数中的open改成自己的就可以

bytearray(b'SangFor{cb4_k27}')

这道题先摸了,回头在认真写

think about it

这题目前也没有找到wp

参考:

  1. 2021羊城杯 部分CRYPTO WP
  2. 羊城杯-高校组-S1gMa战队wp 同一篇文章的 另一个地址
  3. Miss题目脚本的来源
  4. 羊城杯2021-WP

2021羊城杯比赛复现(Crypto)的更多相关文章

  1. 2021 羊城杯WriteUP

    比赛感受 题目质量挺不错的,不知道题目会不会上buu有机会复现一下,躺了个三等奖,发下队伍的wp Team BinX from GZHU web Checkin_Go 源码下载下来发现是go语言写的 ...

  2. 2021蓝桥杯省赛B组(C/C++)E.路径【最短路DP】

    2021蓝桥杯省赛B组题目(C/C++)E.路径 最短路径, 因为变化情况比较多, 所以开始想的是深搜, 但是太慢了, 跑不出来, 后来就想着优化一下, 有的地方到另一个地方可能会考虑很多遍, 于是考 ...

  3. 2021蓝桥杯省赛C++A组试题E 回路计数 状态压缩DP详细版

    2021蓝桥杯省赛C++A组试题E 回路计数 状态压缩DP 题目描述 蓝桥学院由21栋教学楼组成,教学楼编号1到21.对于两栋教学楼a和b,当a和b互质时,a和b之间有一条走廊直接相连,两个方向皆可通 ...

  4. 记intel杯比赛中各种bug与debug【其一】:安装intel caffe

    因为intel杯创新软件比赛过程中,并没有任何记录.现在用一点时间把全过程重演一次用作记录. 学习 pytorch 一段时间后,intel比赛突然不让用 pytoch 了,于是打算转战intel ca ...

  5. 记intel杯比赛中各种bug与debug【其四】:基于长短时记忆神经网络的中文分词的实现

    (标题长一点就能让外行人感觉到高大上) 直接切入主题好了,这个比赛还必须一个神经网络才可以 所以我们结合主题,打算写一个神经网络的中文分词 这里主要写一下数据的收集和处理,网络的设计,代码的编写和模型 ...

  6. 百度杯 black_hole复现

    在这次复现中,经历了太多挫折. 刚刚开始的时候本地调试 get不到shell,就很疑问,而且不会爆破,想学下怎么爆破出那个0x05, 后来问了位师傅 ,他说用retdl_solve 试试,我就跑去学了 ...

  7. C语言蓝桥杯比赛原题和解析

    蓝桥杯:在计算机编程领域,是具有一定含金量的竞赛,用于选拔信息技术人才. 一般分为多个领域,其中包含了C/C#/C++/Java/Python等编程语言的测试题,多为算法的设计题. 下面,在搜题过程中 ...

  8. 羊城杯wp babyre

    肝了好久,没爆破出来,就很难受,就差这题没写了,其他三题感觉挺简单的,这题其实也不是很难,我感觉是在考算法. 在输入之前有个smc的函数,先动调,attach上去,ida打开那个关键函数. 代码逻辑还 ...

  9. 2021“MINIEYE杯”中国大学生算法设计超级联赛(7)部分题解

    前言 找大佬嫖到个号来划水打比赛了,有的题没写或者不是我写的就不放了. 目前只有:1004,1005,1007,1008,1011 正题 题目链接:https://acm.hdu.edu.cn/con ...

随机推荐

  1. Jenkins_忘记管理员密码的处理方法

    1.查看jenkins配置存放目录 2.修改config.xml的useSecurity的true为flase 3.重启jenkins服务 4.进入jenkins,不输入密码直接就进入了jenkins ...

  2. android studio 配置 Lombok 插件 -具体步骤

    1.前言 idea 用惯了 Lombok 插件了,好用的很,可是开发安卓 却没有,即便在 android studio 安装了插件,但是仍然无法使用 因为需要配置 2.解决 (1)进入设置,找到插件设 ...

  3. Oracle 五种约束的创建和移除:

    1.主键约束: 创建表的时候就添加: create table table_name (categoryId varchar2(10), categoryName varchar2(30), prim ...

  4. Go的日志库go-logging

    配置文件config.yaml log: prefix: '[MY-LOG] ' log-file: true stdout: 'DEBUG' file: 'DEBUG' config/config. ...

  5. root安装jdk其它用户授权

    sudo chmod -R 755 java安装目录 sudo chown -R [username] java安装目录

  6. MASA Framework - 整体设计思路

    源起 年初我们在找一款框架,希望它有如下几个特点: 学习成本低 只需要学.Net每年主推的技术栈和业务特性必须支持的中间件,给开发同学减负,只需要专注业务就好 个人见解:一款好用的框架应该是补充,而不 ...

  7. 【Java】二分法查找

    二分法查找 前提:所要查找的数组必须有序 public class Dichotomy { public static void main(String[] args) { int[] array = ...

  8. C#进阶——记一次USB HID的各种坑(x86,x64,win10,win7)

    一.简叙 写工控上位机的搬砖人,难免会遇到USB通讯,在一个项目中,我写的上位机使用USB HID协议和STM32通讯传输数据,从零大概花了几天找例程,找资料,最后是各种搬砖修补,终于出来了一个出版D ...

  9. 开源办公套件DzzOffice安装教程

    DzzOffice开源办公套件 DzzOffice是一套开源办公套件,适用于企业.团队搭建自己的 类似"Google企业应用套件"."微软Office365"的 ...

  10. 首页页面(html+css+js)

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...