内部年度比赛2026

Day2-数据安全赛道

数据安全防护与隐私保护

草稿的背叛

xor 两段数据得到 S3cretK3y2026
再异或第一段即可
flag{ff7d91b8a3ab4ed7982b626be0c1d78f}

数据安全监控与审计

mysql 物探数据清理

某石油企业物探作业系统的数据库中混入了 4 名离场人员及其业务数据,现要求选手连接数据库实施精准清理。数据库用户名 ctf,密码 pswd@123,库名 ctf。

请清理目标人员 4104、4117、4142、4188 及其全部关联数据:沿"人员 → 班组 → 项目 → 测线 / 炮点 / 检波点"逐层清理干净;质控、备注、消息等交叉记录会同时引用人员和项目,两个维度都要处理。只允许 DELETE 操作,不允许通过修改编号、修改归属关系等方式绕过检查;不得误删其他人员的正常数据,也不得留下残留记录。

crew_member 人

select * from  crew_member  where id in(4104,4117,4142,4188) 

id                 name        role_name      phone       status

4104	采集员A	采集员	13800004104	1

4117	采集员B	采集员	13800004117	1

4142	采集员C	采集员	13800004142	1 

4188	采集员D	采集员	13800004188	1

field_team 班组

id  team_name   leader_id  area_name   status

select * from  field_team where leader_id  in (4104,4117,4142,4188) 

2003	C队3	4104	西区一工区	1
2008	H队8	4104	北西工区	1
2013	E队13	4117	中区一工区	1
2018	B队18	4117	东区二工区	1
2023	G队23	4142	北东工区	1
2026	B队26	4142	东区二工区	1
2029	E队29	4188	中区一工区	1
2032	H队32	4188	北西工区	1

survey_project 项目表

select * from  survey_project  where team_id  in (2003,2008,2013,2018,2023,2026,2029,2032)

id  team_id  project_code  line_name phase_name status

3005	2003	P-2026-3005	L-05	施工中	1
3010	2008	P-2026-3010	L-10	施工中	1
3016	2013	P-2026-3016	L-16	施工中	1
3021	2018	P-2026-3021	L-21	施工中	1
3024	2023	P-2026-3024	L-24	施工中	1
3027	2026	P-2026-3027	L-27	施工中	1
3030	2029	P-2026-3030	L-30	施工中	1
3031	2032	P-2026-3031	L-31	施工中	1

survey_line  线

select * from  survey_line where project_id in (3005,3010,3016,3021,3024,3027,3030,3031)

id  project_id  line_code  start_km  end_km

4031	3016	LN-3016-A	0.00	12.50
4032	3016	LN-3016-B	12.50	25.00
4041	3021	LN-3021-A	0.00	12.50
4042	3021	LN-3021-B	12.50	25.00
4047	3024	LN-3024-A	0.00	12.50
4048	3024	LN-3024-B	12.50	25.00
4053	3027	LN-3027-A	0.00	12.50
4054	3027	LN-3027-B	12.50	25.00
4059	3030	LN-3030-A	0.00	12.50
4060	3030	LN-3030-B	12.50	25.00
4061	3031	LN-3031-A	0.00	12.50
4062	3031	LN-3031-B	12.50	25.00

shot_record

select * from  shot_record where project_id in (3005,3010,3016,3021,3024,3027,3030,3031)

select * from  shot_record where line_id  in (4031,4032,4041,4042,4047,4048,4053,4054,4059,4060,4061,4062)

id project_id line_id shot_no energy_level

5009	3005	4009	S-3005-A	normal
5010	3005	4010	S-3005-B	normal
5019	3010	4019	S-3010-A	normal
5020	3010	4020	S-3010-B	normal
5031	3016	4031	S-3016-A	normal
5032	3016	4032	S-3016-B	normal
5041	3021	4041	S-3021-A	normal
5042	3021	4042	S-3021-B	normal
5047	3024	4047	S-3024-A	normal
5048	3024	4048	S-3024-B	normal
5053	3027	4053	S-3027-A	normal
5054	3027	4054	S-3027-B	normal
5059	3030	4059	S-3030-A	normal
5060	3030	4060	S-3030-B	normal
5061	3031	4061	S-3031-A	normal
5062	3031	4062	S-3031-B	normal

receiver_node

select * from  receiver_node where project_id in (3005,3010,3016,3021,3024,3027,3030,3031)

select * from  receiver_node where line_id in (4031,4032,4041,4042,4047,4048,4053,4054,4059,4060,4061,4062)

id   project_id       line_id   node_no channel_count

6009	3005	4009	N-3005-A	96
6010	3005	4010	N-3005-B	96
6019	3010	4019	N-3010-A	96
6020	3010	4020	N-3010-B	96
6031	3016	4031	N-3016-A	96
6032	3016	4032	N-3016-B	96
6041	3021	4041	N-3021-A	96
6042	3021	4042	N-3021-B	96
6047	3024	4047	N-3024-A	96
6048	3024	4048	N-3024-B	96
6053	3027	4053	N-3027-A	96
6054	3027	4054	N-3027-B	96
6059	3030	4059	N-3030-A	96
6060	3030	4060	N-3030-B	96
6061	3031	4061	N-3031-A	96
6062	3031	4062	N-3031-B	96

field_message

select * from  field_message where project_id in (3005,3010,3016,3021,3024,3027,3030,3031)

select * from  field_message where from_member_id  in (4104,4117,4142,4188) 

id   from_member_id  to_member_id project_id msg_body 

9003	1004	1005	3005	数据已经采完,准备回传
9007	1004	1005	3010	数据已经采完,准备回传
9012	1004	1005	3016	数据已经采完,准备回传
9016	1004	1005	3021	数据已经采完,准备回传
9021	1004	1005	3024	数据已经采完,准备回传
9025	1004	1005	3027	数据已经采完,准备回传
9030	1004	1005	3030	数据已经采完,准备回传
9034	1004	1005	3031	数据已经采完,准备回传
9039	4104	1004	3005	数据已经采完,准备回传
9043	4117	1004	3010	数据已经采完,准备回传
9048	4142	1004	3016	数据已经采完,准备回传
9052	4188	1004	3021	数据已经采完,准备回传

select * from  field_message where to_member_id in (4104,4117,4142,4188) 

9055	1005	4104	3001	收到,继续推进
9058	1005	4117	3002	收到,继续推进
9061	1005	4142	3003	收到,继续推进
9064	1005	4188	3004	收到,继续推进

coordinate_note  done

id  project_id  creator_id  note_type   content

select * from  coordinate_note where project_id in (3005,3010,3016,3021,3024,3027,3030,3031)

8002	3005	4104	工区备注	正常推进
8007	3010	4117	工区备注	正常推进
8011	3016	4142	工区备注	正常推进
8016	3021	4188	工区备注	正常推进
8028	3024	1001	工区备注	正常推进
8031	3027	1001	工区备注	正常推进

select * from  coordinate_note where creator_id   in (4104,4117,4142,4188) 

8021	3001	4104	工区备注	正常推进
8024	3002	4117	工区备注	正常推进

qc_log

select * from  qc_log where crew_member_id  in (4104,4117,4142,4188)

id  project_id  crew_member_id  qc_type  qc_result

7003	3005	4104	道间一致性	pass
7009	3010	4117	道间一致性	pass
7014	3016	4142	道间一致性	pass
7018	3021	4188	道间一致性	pass
7023	3001	4104	道间一致性	pass
7026	3002	4117	道间一致性	pass

select * from  qc_log where project_id in (3005,3010,3016,3021,3024,3027,3030,3031)

7029	3024	1002	道间一致性	pass
7032	3027	1002	道间一致性	pass

SELECT * FROM flag;

flag{jspEoBgjv3yepczwbNRP}

井场巡检键鼠串联

直接用上课给的脚本解一下。

管输智能调度系统

批量上传接近域值的数据。让整体范围上升。

油库门禁卡排查

import pandas as pd

# 1. 读取数据 (注意都是 csv)
cards = pd.read_csv('cards.csv')
logs = pd.read_csv('swipe_logs.csv')

# 2. 转换时间类型
cards['ExitAt'] = pd.to_datetime(cards['ExitAt'])
logs['SwipeAt'] = pd.to_datetime(logs['SwipeAt'])

audit_deadline = pd.Timestamp('2025-09-30 23:59:59')

# 3. 筛选基础条件的卡 (Valid, 非正式员工, ExitAt < deadline)
valid_cards = cards[
    (cards['CardStatus'] == 'Valid') & 
    (cards['HolderType'] != '正式员工') & 
    (cards['ExitAt'] < audit_deadline)
].copy()

# 4. 筛选基础条件的日志 (夜间, IN, CORE, SwipeAt <= deadline)
hours = logs['SwipeAt'].dt.hour
is_night = (hours >= 22) | (hours < 6)

filtered_logs = logs[
    is_night & 
    (logs['Direction'] == 'IN') & 
    (logs['ZoneLevel'] == 'CORE') & 
    (logs['SwipeAt'] <= audit_deadline)
].copy()

# 5. 关联数据:将过滤后的日志与过滤后的卡进行内连接
merged = filtered_logs.merge(valid_cards, on='CardID', how='inner')

# 6. 最终筛选:SwipeAt > ExitAt (刷卡时间在离场之后)
abnormal_logs = merged[merged['SwipeAt'] > merged['ExitAt']].copy()

if abnormal_logs.empty:
    print("flag{NONE}")
else:
    # 7. 统计异常卡数量 (按CardID去重后计数)
    unique_cards = abnormal_logs.drop_duplicates(subset=['CardID'])
    card_counts = unique_cards.groupby('DepotCode').size().reset_index(name='AbnormalCardCount')

    # 8. 统计命中日志数量
    log_counts = abnormal_logs.groupby('DepotCode').size().reset_index(name='LogCount')

    # 9. 合并统计结果
    stats = card_counts.merge(log_counts, on='DepotCode', how='left').fillna(0)
    stats['AbnormalCardCount'] = stats['AbnormalCardCount'].astype(int)
    stats['LogCount'] = stats['LogCount'].astype(int)

    # 10. 排序:异常卡数量降序、日志数量降序、站点编码升序
    stats_sorted = stats.sort_values(by=['AbnormalCardCount', 'LogCount', 'DepotCode'], 
                                     ascending=[False, False, True])

    # 11. 取第一名
    top_depot = stats_sorted.iloc[0]['DepotCode']
    print(f"flag{{{top_depot}}}")

井场巡检车热点

过滤 eapol # 按source 排序, 234是加密的。如果少于2项是没加密。
Message 1 -> Message 2 -> Message 3 -> Message 4 连续且完整。就是加密的。


28400	116.727731	02:aa:bb:cc:dd:02	66:55:44:33:22:21	Key (Message 1 of 4)
28401	116.731125	66:55:44:33:22:21	02:aa:bb:cc:dd:02	Key (Message 2 of 4)
28402	116.736288	02:aa:bb:cc:dd:02	66:55:44:33:22:21	Key (Message 3 of 4)
28403	116.738820	66:55:44:33:22:21	02:aa:bb:cc:dd:02	Key (Message 4 of 4)

28399	116.723552	02:aa:bb:cc:dd:03	66:55:44:33:22:11	Key (Message 1 of 4)

32804	137.387952	02:aa:bb:cc:dd:02	66:55:44:33:22:22	Key (Message 1 of 4)
32805	137.392223	66:55:44:33:22:22	02:aa:bb:cc:dd:02	Key (Message 2 of 4)
32806	137.394765	02:aa:bb:cc:dd:02	66:55:44:33:22:22	Key (Message 3 of 4)
32807	137.395743	66:55:44:33:22:22	02:aa:bb:cc:dd:02	Key (Message 4 of 4)

02:aa:bb:cc:dd:02 是加密的WIFI, 02:aa:bb:cc:dd:03是未加密的
过滤 wlan.addr == 66:55:44:33:22:11 && http 就是未加密的数据

在文件中找到信息

night-checklist.html
2026-09.html
briefing.html
pad_rule.js
safefirst_banner.jpg

<html><body><h2>井场巡检简报</h2><p>当前重点井:XJ-27</p><p>其余井口按既定路线处理。</p></body></html> -- well(nodash): XJ
<html><body><div class="month">09</div><p>九月巡检排班</p></body></html> -- month: 09
<html><body><p>当班信息:Night</p><p>夜班巡检注意照明与回传时效。</p></body></html> -- shift(initial): 班次首字母 N
IF-SafeFirst-Banner     -- slogan: SafeFirst
function build(){return "slogan-well(nodash)-shift(initial)-month";}

密码
SafeFirst-XJ27-N-09

2	0.003400	02:aa:bb:cc:dd:02	Broadcast		802.11	95	Beacon frame, SN=0, FN=0, Flags=........, BI=100, SSID="CNPC-Inspect"

WIFI名称 CNPC-Inspect

首选项 - IEEE 802.11 添加类型 , 勾选 Enable decryption
Key type (密钥类型) 选择:wpa-pwd。

Key (密钥) 栏输入格式为 格式 [密码]:[SSID]
SafeFirst-XJ27-N-09:CNPC-Inspect

过滤一下
wlan.addr == 02:aa:bb:cc:dd:02 && http contains "flag"

flag{guest_first_then_inspect}

数据全生命周期安全管理

井场钻井日志及流量数据取证

http包按大小排第一个有图片 flag

数据安全风险监测、评估与处置

物流协同资料差异

F12看记录里面有

{
    "batch_id": "LD-NC-20260817-014",
    "documents": [
        {
            "id": "handover-20260817",
            "name": "交接说明.txt",
            "type": "TXT",
            "description": "资料用途、交接范围与联系人",
            "size": "1 KB",
            "external_visible": true,
            "download_url": "/api/documents/handover-20260817/download"
        },
        {
            "id": "inventory-detail-20260817",
            "name": "库存明细_20260817.csv",
            "type": "CSV",
            "description": "当日储罐库存明细",
            "size": "1 KB",
            "external_visible": true,
            "download_url": "/api/documents/inventory-detail-20260817/download"
        },
        {
            "id": "inventory-detail-20260816",
            "name": "库存明细_20260816.csv",
            "type": "CSV",
            "description": "上一日库存参考",
            "size": "1 KB",
            "external_visible": true,
            "download_url": "/api/documents/inventory-detail-20260816/download"
        },
        {
            "id": "inventory-summary-20260817",
            "name": "库存汇总_20260817.csv",
            "type": "CSV",
            "description": "当日油库库存汇总",
            "size": "1 KB",
            "external_visible": true,
            "download_url": "/api/documents/inventory-summary-20260817/download"
        },
        {
            "id": "tank-register-current",
            "name": "储罐台账.csv",
            "type": "CSV",
            "description": "储罐基础信息及外发状态",
            "size": "1 KB",
            "external_visible": true,
            "download_url": "/api/documents/tank-register-current/download"
        },
        {
            "id": "dispatch-plan-20260818",
            "name": "发运计划_20260818.csv",
            "type": "CSV",
            "description": "次日车辆发运计划",
            "size": "1 KB",
            "external_visible": true,
            "download_url": "/api/documents/dispatch-plan-20260818/download"
        },
        {
            "id": "asset-8f7c2b91",
            "name": "物流协同外发配置.yml",
            "type": "CFG",
            "description": "资料生成配置快照",
            "size": "1 KB",
            "external_visible": false,
            "download_url": "/api/documents/asset-8f7c2b91/download"
        }
    ]
}
界面点一个下载, 用这个  asset-8f7c2b91 id进行下载配置
# http://10.100.100.119:12840/api/documents/asset-8f7c2b91/download

img

好像是25行提交成功

加油站运营数据平台日志排查

└─$ grep -nE '/download\?file=.*(\.\./|\.\.%2[Ff])' access.log
5542:101.37.88.24 - - [18/May/2026:01:14:02 +0800] "GET /download?file=../../../etc/passwd HTTP/1.1" 404 512 "https://ops.gas.example/api/station/report/list?page=1&size=20&region=all" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" "-" "0.442"
5726:101.37.88.24 - - [18/May/2026:01:14:27 +0800] "GET /download?file=../../../app/config/application-prod.yml HTTP/1.1" 403 721 "https://ops.gas.example/download?file=../../../etc/passwd" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" "-" "0.615"
5996:101.37.88.24 - - [18/May/2026:01:15:09 +0800] "GET /download?file=..%2F..%2F..%2Ftmp%2Frpt_20260517_8f2c.tar.gz HTTP/1.1" 200 28573412 "https://ops.gas.example/download?file=../../../app/config/application-prod.yml" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" "-" "12.408"

flag{2026-05-18-01:14:02_101.37.88.24_rpt_20260517_8f2c.tar.gz}

重要敏感数据治理

银行卡迷局:审计档案中的秘密

  1. 按提示提取银行卡号
  2. 有效性检查 luhn
  3. 提取 4-6 位
  4. 转换为 ASCII 字节, zlib 解压
  5. 保存为文件

这个题目坑点在于附件中的
备注:银行卡字段存在多种分组形式。请识别有效卡片,并恢复审计归档中的原始文件。
没有见过 1234 5678-8901 2345 这种格式,一直提取不对, 其实本题忽略这些问题 包括-和空格, 16位数字就行

import base64, re
import zlib


def read_card_numbers(file_path: str) -> list[str]:
    """步骤 1:读取文件并清理格式(过滤空行与空白字符)"""
    with open(file_path, "r", encoding="utf-8") as f:
        data = f.read()
    pattern = r"银行卡:(\d{4}(?:[ -]?\d{4}){3})"
    matches = re.findall(pattern, data)
    cards = [re.sub(r"\D", "", m) for m in matches]
    return cards


def is_valid_luhn(card_number: str) -> bool:
    """步骤 2:使用 Luhn 算法(模 10 算法)校验银行卡号是否真实有效"""
    if not card_number.isdigit():
        return False

    total = 0
    reverse_digits = [int(d) for d in reversed(card_number)]

    for i, digit in enumerate(reverse_digits):
        if i % 2 == 1:
            doubled = digit * 2
            total += doubled - 9 if doubled > 9 else doubled
        else:
            total += digit

    return total % 10 == 0


def filter_valid_cards(cards: list[str]) -> list[str]:
    """步骤 3:过滤掉假的银行卡"""
    return [card for card in cards if is_valid_luhn(card)]


def extract_middle_digits(cards: list[str]) -> list[str]:
    """步骤 4:提取每张卡号的第 4 到 6 位(切片 [3:6])"""
    extracted = []
    for card in cards:
        if len(card) >= 6:
            extracted.append(card[3:6])
    return extracted


def save_as_ascii_bytes(digits_list: list[str], output_path: str):
    """步骤 5:将 10 进制 ASCII 码(如 "101")转为对应的字节(如 101 -> b'e')保存"""
    bdata = bytearray(map(int, digits_list))
    return base64.b64decode(bdata + b'====')


def main():
    """主控逻辑:按流程调用各个函数"""
    input_file = "attachment.txt"
    output_file = "extracted_bytes.bin"

    # 1. 读取卡号
    cards = read_card_numbers(input_file)

    # 2 & 3. 过滤假卡
    valid_cards = filter_valid_cards(cards)

    # 4. 提取 4-6 位(如 "101", "078")
    extracted_digits = extract_middle_digits(valid_cards)

    # 5. 将 10 进制 ASCII 码转换为字节并保存
    ascii_bytes = save_as_ascii_bytes(extracted_digits, output_file)
    # file 命令查看其实是 zlib, 解压下
    decompressed_bytes = zlib.decompress(ascii_bytes)
    # 异或 0x7F 文件头正好为MZ, exe程序
    decrypted_bytes = bytes([x ^ 0x7F for x in decompressed_bytes])

    with open(output_file, "wb") as f:
        f.write(decrypted_bytes)

    print(f"转换完成,已将 {len(extracted_digits)} 个 ASCII 字节写入 {output_file}")


if __name__ == "__main__":
    main()

二进制分析写了是SM4解密, Correct 之前进行了 0x7F 异或操作, 魔改了FK, 普普通通SM4解密

while ( (Str2[v61] ^ 0x7F) == byte_1400CA100[v61] )
{
  if ( ++v61 == 48 )
  {
    sub_1400C1410(&unk_1400C8B60, "Correct!\n");
  }
from gmssl import sm4
sm4.SM4_FK = [0xB0E6A119, 0x72C29FB0, 0x6863BCAB, 0xE7DA7776]

key = bytes.fromhex('102030405060708090A0B0C0D0E0F000')
ct_hex = '7297F6652450301503BDDE7E73E7022D4E40840F9F98B2EEB2F6CBA54762181D90DE53CAF42FF1650D15D071EEE5EFB8'
encrypted_data = bytes(b ^ 0x7F for b in bytes.fromhex(ct_hex))

gmsm4 = sm4.CryptSM4(sm4.SM4_DECRYPT, sm4.PKCS7)
gmsm4.set_key(key, sm4.SM4_DECRYPT)

# 4. 解密并输出结果
plaintext = gmsm4.crypt_ecb(encrypted_data)
print("Flag:", plaintext.decode('utf-8', errors='ignore'))
# flag{8adb11d95c314577b5da9d6b4f97fc80}

Day3-运维与漏洞挖掘

物流系统

访问 /actuator/heapdump 下载后 strings heapdump 里面有flag

供应商协同平台

供应商协同平台-任务二

Jadx打开apk查看

  1. 关键代码分析:在 sources/com/vendorlink/auth/LegacyMobileJwtKeyProvider.java 中,签名密钥是通过以下方式生成的:
    public SecretKey signingKey() {
    String material = this.product + this.separator + this.rotationYear + this.suffix;
    return new SecretKeySpec(material.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
    }
  2. 配置参数提取:通过分析 resources/BOOT-INF/classes/legacy-auth.properties 文件,可以获取到拼接所需的属性值:
    • product: VendorLink
    • separator: @
    • rotationYear: 2025
    • suffix: !
  3. 密钥构造:将上述参数按顺序拼接,得到的字符串为:VendorLink@2025!。

生产调度管理系统

按照提示操作
通过 admin 登录,无密码

栏目编辑页字段 coverTemp。选封面栏目(如系统说明 code=6rztc072),封面模板改为 ../../../../flag(保存时变成 /../../../../flag), 访问即可

项目管理系统

项目管理系统-任务一

字典爆破 admin, 1qaz2wsx, 弱口令。

云原生平台

云原生平台-任务一

cat /opt/cloudnative/docs/node-runtime.txt
command -v containerd containerd-shim ctr kubelet
ls -ld /run/containerd /etc/containerd /var/lib/kubelet 2>/dev/null
ls -l /usr/local/bin/containerd-agent
ps -eo pid,user,comm,args | grep -F containerd
ss -lntp | grep containerd
/usr/local/bin/containerd-agent --help

发现是这个
/usr/local/bin/containerd-agent
给它改个名, 然后kill掉即可。

云原生平台-任务二

posted @ 2026-09-18 06:29  wgf4242  阅读(35)  评论(0)    收藏  举报