网安知识大挑战-FINAL
题目
题目:
1. **习近平总书记强调“没有网络安全就没有国家安全”。这句话主要强调了以下哪一方面?**
- A) 网络安全与教育发展的关系
- B) 网络安全与文化交流的关系
- C) 网络安全与经济发展的关系
- D) 网络安全与国家安全的关系
2. **在习近平总书记的网络安全论述中,哪一项被视为网络安全的基础性手段?**
- A) 公众教育
- B) 依法治网
- C) 国际合作
- D) 技术创新
3. **习近平总书记提出的网络安全观中,以下哪一项是关键内容?**
- A) 网络安全与文化传播的结合
- B) 网络安全与金融安全的融合
- C) 网络安全与信息化的一体化
- D) 网络安全与旅游发展的协同
4. **习近平总书记强调网络安全为人民、网络安全靠人民。这一论述强调了哪一方面的重要性?**
- A) 企业的技术创新
- B) 国际社会的合作
- C) 人民群众的参与和支持
- D) 政府的监管作用
5. **在习近平总书记的网络安全论述中,哪一项被视为推动全球互联网治理的方向?**
- A) 扩大网络基础设施建设
- B) 推动网络文化输出
- C) 尊重网络主权
- D) 加强网络技术封锁
6. **根据习近平总书记的论述,面对网络犯罪日益严重的形势,以下哪一项是有效的应对措施?**
- A) 增加网络娱乐内容
- B) 放宽网络监管
- C) 加强网络立法和执法
- D) 降低网络安全标准
7. **习近平总书记在网络安全方面强调要做到“关口前移,防患于未然”。这主要指的是哪一项措施?**
- A) 提高网络攻击后的应急响应速度
- B) 加强网络安全的事前防护和预警
- C) 增加网络安全的资金投入
- D) 扩大网络安全的国际宣传
8. **习近平总书记提到要加强关键信息基础设施的保护。以下哪一项是关键信息基础设施的典型例子?**
- A) 在线游戏服务器
- B) 社交媒体平台
- C) 国家电力系统
- D) 电子商务网站
9. **习近平总书记强调国际社会应该在相互尊重、相互信任的基础上推动互联网全球治理。这一观点主要旨在:**
- A) 推动全球网络文化的统一
- B) 实现全球网络经济一体化
- C) 加强网络技术的全球标准化
- D) 建立多边、民主、透明的互联网治理体系
10. **习近平总书记在网络安全领域强调要统筹兼顾、综合施策。以下哪一项最能体现这一策略?**
- A) 单一技术手段解决所有网络安全问题
- B) 多部门协作、综合运用法律、技术、管理等手段
- C) 依赖国际援助解决国内网络安全问题
- D) 聚焦某一领域的网络安全,忽略其他领域
密文: 570fc2416dad7569c13356820ba67ba628c6a5fcbc73f1c8689612d23c3a779befeacf678f93ff5eb4b58dc09dcb9a89
Key:??????????000000 <= ?是每个题目的答案大写
IV: 12345678
flag格式为 DASTCF{xxxxx},提交时只需要提交括号中间的内容。
题解
Crypto1 - Mycode
简单的爆破
题目
import numpy as np
def substitute(state, sub_box):
return [sub_box[b & 0xF] | (sub_box[(b >> 4) & 0xF] << 4) for b in state]
def generate_round_keys(base_key, rounds):
round_keys = []
temp_key = base_key
for _ in range(rounds):
round_keys.append(temp_key & 0xFFFFFFFF)
temp_key ^= ((temp_key << 1) & 0xFFFFFFFF) | ((temp_key >> 31) & 0x1)
return round_keys
def process_state(base_key, state, rounds, encrypt):
sub_box = [0x9, 0x4, 0xA, 0xB, 0xD, 0x1, 0x8, 0x5, 0x6, 0x2, 0x0, 0x3, 0xC, 0xE, 0xF, 0x7]
inv_sub_box = [0xA, 0x5, 0x9, 0xB, 0x1, 0x7, 0x8, 0xF, 0x6, 0x0, 0x2, 0x3, 0xC, 0x4, 0xD, 0xE]
round_keys = generate_round_keys(base_key, rounds)
if encrypt:
for round in range(rounds):
state = substitute(state, sub_box)
state = [s ^ ((round_keys[round] >> (i * 8)) & 0xFF) for i, s in enumerate(state)]
else:
for round in range(rounds - 1, -1, -1):
state = [s ^ ((round_keys[round] >> (i * 8)) & 0xFF) for i, s in enumerate(state)]
state = substitute(state, inv_sub_box)
return state
def encrypt(plaintext, key, rounds=10):
length = len(plaintext)
padded_length = length if length % 4 == 0 else length + (4 - (length % 4))
plaintext += b'\x00' * (padded_length - length)
ciphertext = bytearray(padded_length)
for i in range(0, padded_length, 4):
state = list(plaintext[i:i+4])
state = process_state(key, state, rounds, True)
ciphertext[i:i+4] = state
return ciphertext
def decrypt(ciphertext, key, rounds=10):
length = len(ciphertext)
plaintext = bytearray(length)
for i in range(0, length, 4):
state = list(ciphertext[i:i+4])
state = process_state(key, state, rounds, False)
plaintext[i:i+4] = state
return plaintext.rstrip(b'\x00')
def main():
plaintext = b"DASCTF{******}"
key = 0xECB... # 4 bytes
ciphertext = encrypt(plaintext, key)
print("Ciphertext:", ''.join(f"{b:02X}" for b in ciphertext))
if __name__ == "__main__":
main()
# Ciphertext: A6B343D2C6BE1B268C3EA4744E3AA9914E29A0789F299022820299248C23D678442A902B4C24A8784A3EA401
题解
总共4字节,key=0xECB.....16进制,已经有了12bit,还差20bit 20//4=5,说明要爆破5bit
因为是16进制,所以只需要在0123456789ABCCDEF中爆破,加解密均已给出,直接解密即可
print(len(TABLE))
for i in tqdm(TABLE):
for j in TABLE:
for k in TABLE:
for l in TABLE:
for m in TABLE:
key = "ECB"
test_key = key + i+j+k+l+m
key = int(test_key, 16)
plaintext = b"DASC"
ciphertext = encrypt(plaintext, key)
if ciphertext==ciher[:4]:
print(key)
print(test_key)
key=0xECB4F678
直接解密
mm=decrypt(ciher, key)
print(mm)
bytearray(b'DASCTF{6ef4d8e1-845a-4e3c-a4e1-a15e5530a0f4}')
实现了一个简单的基于替换盒(Substitution Box)的加密和解密方案。它通过密钥扩展生成多个轮密钥,并使用这些轮密钥对数据进行加密或解密。加密和解密的核心是process_state
函数,它会对每个字节进行替换,并通过异或操作与当前轮次的密钥进行处理。加密时,首先使用替换盒(sub_box
)对每个字节进行替换,然后与轮密钥进行异或,并重复多轮加密;解密时,则是将轮次反向,并使用反替换盒(inv_sub_box
)进行处理。明文在加密前会按4字节一组分割,如果不足4字节则使用\x00
进行填充。加密后的密文通过encrypt
函数返回,解密时则通过decrypt
函数恢复明文。
Crypto2 - DlcgH_r
简单的密钥交换
题目
from Crypto.Util.number import *
from gmpy2 import *
flag = b'DASCTF{******}'
def iterate_function(seed, coeff_a, coeff_b, prime_modulus):
return (coeff_a * seed + coeff_b) % prime_modulus
def iterate_multiple_times(seed, num_iterations, coeff_a, coeff_b, prime_modulus):
for _ in range(num_iterations):
seed = iterate_function(seed, coeff_a, coeff_b, prime_modulus)
return seed
p = getPrime(600)
a = getPrime(512)
b = getPrime(512)
s = getPrime(512)
k = getPrime(512)
t = getPrime(512)
A = iterate_multiple_times(s, k, a, b, p)
B = iterate_multiple_times(s, t, a, b, p)
print("p =", p)
print("a =", a)
print("b =", b)
print("s =", s)
print("A =", A)
print("B =", B)
secret1 = iterate_multiple_times(A, k, a, b, p)
secret2 = iterate_multiple_times(B, t, a, b, p)
assert secret1 == secret2
'''
p = 2565258348684709722726260231955260453241716968378483821594041597297293609376806025180965681289016169408781752953380586044352169083397987333072306444539318806255242559916564022662479
a = 7703427441632069990122897903141278700284019287330080801753208940444135129072547305259960648105321270085533531118395452229965873504176368162947864923497711
b = 8477265953761650860710068507342719089504862957398782381045770264963932696457722724393775545810962476516315838411812248360284564925846788951219272632661157
s = 9228773209718156231041982890745928246648483643042884535935071957475932603607283209094294685862893340598940862096657878372229519375655468524041406914666867
A = 434251860827782638796736001849473241231781620594954088572922898040098881748337513244415553659525671751903798527967205418513869125476445927127124010452649344318178999731385274553080
B = 434251860827782638796736001849473241231781620594954088572922898040098881748337513244415553659525671751903798527967205418513869125476445927127124010452649344318178999731385274553080
'''
p2 = next_prime(secret1)
q2 = getPrime(600)
n2 = p2*q2
e = 4
m = bytes_to_long(flag)
c = pow(m, e, n2)
print("n2 =", n2)
print("c =", c)
'''
n2 = 3241139665583501598296135149075754735041636843305130049654913708275571916563715101898946962033698805416493133339619007016676895968314902474922279948997540924678346952667095320094789476561995339618782687993966133770687551933070478999383821269223854568552819152909266096733330218505088222661907600152055916956562332379930822529724151378274932991887183193175206749
c = 1131281812215293796960536920068009435705926803182047772347743960804329656316689664084120353862091370978145286943689311985878028828902275260824388998300548644880722651153603738691769179255824425771260974588160589473958033612303767050773921373389315920529311000160530833707622310013322631917184737227893101365726934901652170763292132835433158093074003616578836411
'''
题解
lcg生成器
发现P-1光滑,Pohlig-Hellman算法,求出k,k=12345
sage
from Crypto.Util.number import *
p=2565258348684709722726260231955260453241716968378483821594041597297293609376806025180965681289016169408781752953380586044352169083397987333072306444539318806255242559916564022662479
a=7703427441632069990122897903141278700284019287330080801753208940444135129072547305259960648105321270085533531118395452229965873504176368162947864923497711
b=8477265953761650860710068507342719089504862957398782381045770264963932696457722724393775545810962476516315838411812248360284564925846788951219272632661157
s=9228773209718156231041982890745928246648483643042884535935071957475932603607283209094294685862893340598940862096657878372229519375655468524041406914666867
A=434251860827782638796736001849473241231781620594954088572922898040098881748337513244415553659525671751903798527967205418513869125476445927127124010452649344318178999731385274553080
B=434251860827782638796736001849473241231781620594954088572922898040098881748337513244415553659525671751903798527967205418513869125476445927127124010452649344318178999731385274553080
k = int(b*inverse(1-a,p))%p
an = (A - k)*inverse(s-k,p)%p
k = discrete_log(mod(an,p),mod(a,p))
分解出p,q,e和p-1,q-1都不互素,
求解 m mod p 和 m mod q、 ,再通过CRT还原 m mod n,有限域开方
from Crypto.Util.number import *
c=1131281812215293796960536920068009435705926803182047772347743960804329656316689664084120353862091370978145286943689311985878028828902275260824388998300548644880722651153603738691769179255824425771260974588160589473958033612303767050773921373389315920529311000160530833707622310013322631917184737227893101365726934901652170763292132835433158093074003616578836411
p=1472490340321845700492870656866629756386520746748019952980831685935628618084832981576756885932019702470337632472478610542460495595381421112792242654382213433012352298291319463142659
q=2201127964530536768531437690590447485511044947862563552674657770394302822371223893779621142446998848918986248500749184930380894798831854267120305815092270548187578354416455278612511
e = 4
P.<a>=PolynomialRing(Zmod(p),implementation='NTL')
f=a^e-c
mps=f.monic().roots()
P.<a>=PolynomialRing(Zmod(q),implementation='NTL')
g=a^e-c
mqs=g.monic().roots()
for mpp in mps:
x=mpp[0]
for mqq in mqs:
y=mqq[0]
solution = hex(CRT_list([int(x), int(y)], [p, q]))[2:]
if solution.startswith('666c'):
print(solution)
mqs
[(2201127964530536768531437690590447485511044947862563552674657770394302822368777907007849755569975307665255069276405563729556961877573599538181798713602319251307805940371240942704290,
1),
(2445986771771386877023541253731179224343621200823932921258254728938507101489951296879772414045214335908221,
1)]
sage: long_to_bytes(2201127964530536768531437690590447485511044947862563552674657770394302822368777907007849755569975307665255069276405563729556961877573599538181798713602319251307805940371240942704290)
b'\x87\xcb\xd8\xb4/_\xdf\xcb`\xebe\xa5\xca\xd9-\xd5X\x94Sm[\xfe\xf93eQ\xc5\xd7\x84c\xcc\xfbh\x0b\x87\x84\x89Jw\x0c71\xd1g\xc4_\xe0\x07\x1b\x0e\xdf\xbd\xe4Zv\x05\xe97\xf4b\xdd\xb2\xa4/\xf7uP\xc4j\n\xd7\x17\xb6\x16\xa2'
long_to_bytes(2445986771771386877023541253731179224343621200823932921258254728938507101489951296879772414045214335908221)
b'DASCTF{450a759e-1c7d-4b97-a9de-78b31eff42a9}'
Crypto3 - APT
题目
All you gotta dO is just meet me at the
题解
追踪流
后缀不变,不断向前爆破测试,[Padding Oracle 攻击],如果返回flase,无效填充,如果updata,说明是有效填充。
可以发现最终有效填充三段
s1="fmAHPUw6jDjBkPazb+pmirrMiho7K1HUkPh7eRLDz88="
s2="+ojFS3tvHoXQvDQoUoeAnkvZXxXR3T8AEwnhXlpfy3E="
s3="E5YOTYCSblhCZPdITEndZzxiOsiSxRp/1GYoXn6YKgQ="
secret=KjFEbghs52mB1LniL64p27rMiho7K1HUkPh7eRLDz89L2V8V0d0/ABMJ4V5aX8txPGI6yJLFGn/UZihefpgqBA==
发现第一串MDAwMDAwMDAwMDAwMDAwALrMiho7K1HUkPh7eRLDz88=后面的Miho7K1HUkPh7eRLDz8在secret里面
已知flag的开头是DASCTF{ 不够16字节,在后面补0
print(long_to_bytes(bytes_to_long(b'DASCTFT{\x00\x00\x00\x00\x00\x00\x00\x00')^bytes_to_long(b64decode(s1.encode())[:16])^bytes_to_long(secret[:16])))
测试发现b'\x10\x10\x10\x10\x10\x10?*@DOQ@DOQ'
猜测iv=b'\x10'*16
s=[b64decode(s1.encode()),b64decode(s2.encode()),b64decode(s3.encode())]
iv=b'\x10'*16
for i in range(3):
print(long_to_bytes(bytes_to_long(iv)^bytes_to_long(s[i][:16])^bytes_to_long(secret[i*16:i*16+16])))
b'DASCTF{APT_APT_A'
b'PT_APT_APT_APT_A'
b'H_AHA_AHA}\x06\x06\x06\x06\x06\x06'
Misc1-FinalSign
题目
恭喜你来到这里,你能解开下面的秘密吗?
2c243f2f3b3114345d0a0909333f06100143023b2c55020912
题解
打开010,像snow隐写 无密码,打开snow.exe工具解密
得到异或Key, 2c243f2f3b3114345d0a0909333f06100143023b2c55020912 hex
然后再异或