Remember the "hillst0ne" challenge in L3HCTF2021?L3HSec also has an MSR3610 router deployed since 2021. Now we have decided to upgrade to a newer model, but we couldn't find the PPPoE password. Could you locate it in the existing configuration?
[L3HSEC-ROUTER-1]show current-configuration # version 7.1.064, Release 0821P16 # sysname L3HSEC-ROUTER-1 # wlan global-configuration # security-zone intra-zone default permit # dhcp enable dhcp server always-broadcast # dns proxy enable # system-working-mode standard password-recovery enable # vlan 1 # dhcp server ip-pool lan1 gateway-list 192.168.0.1 network 192.168.0.0 mask 255.255.254.0 address range 192.168.1.2 192.168.1.254 dns-list 192.168.0.1 # controller Cellular0/0 # interface Dialer0 ppp chap password cipher $c$3$TKYJXT4RmMIvPHQX+5Ehf9oD3kjskIur3PGJfR/7fEyqfbx0K0DAokR0pd3rsRbWR5t9Cr3xSbYoPdogCg== ppp chap user hustpppoe114514 ppp pap local-user hustpppoe114514 password cipher $c$3$3PbDU2m2/6Neiiz9iO+i641UKjafFMvrfphBc3fmrZ+9Q2TZu3g5l2Hlg1gJWO6ZQLJ4S+r85qU8EQpqQQ== dialer bundle enable dialer-group 2 dialer timer idle 0 dialer timer autodial 5 ip address ppp-negotiate nat outbound # interface NULL0 # interface GigabitEthernet0/0 port link-mode route description LAN-interface ip address 192.168.0.1 255.255.254.0 tcp mss 1280 # interface GigabitEthernet0/1 port link-mode route # interface GigabitEthernet0/1.3647 vlan-type dot1q vid 3647 pppoe-client dial-bundle-number 0 # interface GigabitEthernet0/2 port link-mode route combo enable copper # interface GigabitEthernet0/3 port link-mode route combo enable copper # interface GigabitEthernet0/4 port link-mode route # interface GigabitEthernet0/5 port link-mode route # scheduler logfile size 16 # line class console user-role network-admin # line class tty user-role network-operator # line class vty user-role network-operator # line con 0 user-role network-admin # line vty 0 63 authentication-mode scheme user-role network-operator # performance-management # password-control enable undo password-control aging enable undo password-control history enable password-control length 6 password-control login-attempt 3 exceed lock-time 10 password-control update-interval 0 password-control login idle-time 0 # domain system # domain default enable system # role name level-0 description Predefined level-0 role # role name level-1 description Predefined level-1 role # role name level-2 description Predefined level-2 role # role name level-3 description Predefined level-3 role # role name level-4 description Predefined level-4 role # role name level-5 description Predefined level-5 role # role name level-6 description Predefined level-6 role # role name level-7 description Predefined level-7 role # role name level-8 description Predefined level-8 role # role name level-9 description Predefined level-9 role # role name level-10 description Predefined level-10 role # role name level-11 description Predefined level-11 role # role name level-12 description Predefined level-12 role # role name level-13 description Predefined level-13 role # role name level-14 description Predefined level-14 role # user-group system # local-user admin class manage service-type telnet http authorization-attribute user-role network-admin # ip http enable web new-style # wlan ap-group default-group vlan 1 # return [L3HSEC-ROUTER-1]
关键信息
设备型号
1
MSR3610
固件版本
1
version7.1.064, Release 0821P16
PPPoE密码的密文,这里chap和pap对应同一个密码
1 2 3
ppp chap password cipher $c$3$TKYJXT4RmMIvPHQX+5Ehf9oD3kjskIur3PGJfR/7fEyqfbx0K0DAokR0pd3rsRbWR5t9Cr3xSbYoPdogCg== ppp chap user hustpppoe114514 ppp pap local-user hustpppoe114514 password cipher $c$3$3PbDU2m2/6Neiiz9iO+i641UKjafFMvrfphBc3fmrZ+9Q2TZu3g5l2Hlg1gJWO6ZQLJ4S+r85qU8EQpqQQ==
ID 0004 CT_SIZE 0034 IV 9B33 AE DE 8E 29 B2 2A 9E D1 8C 1D CD A7 3258 CT DF BF 4E 75 AD D5 292B 5478 BE 478904148A 347B F4 FD EC FC 7A EE 87 AF 83 C6 2E 3B 0B 26422F 1348070B 4465 AD A8 CA 0F F4 8D 961084687B 6A
生成解密密钥数据用的密钥
1 2 3 4 5 6 7 8 9 10
from hashlib import sha512
fp = open("key-data",'rb') data = fp.read()[0x2:0x102] a = sha512() a.update(data[0x40:0x80]) a.update(data[0x0:0x40]) a.update(data[0x80:]) print(a.digest()[:0x20].hex()) #ecc679703bb2daf7c09a941cb992dcdd03150e0f67ed9b32a548d8624add9c07
获得解密PASSWORD用的密钥数据
密钥数据格式如下
1 2 3 4 5 6 7 8
IV_SIZE 0010 KEY_SIZE 0020 IV c695c466f32e90d0fb12ed31c5c72265 KEY a2e6658865746b4b954f0bd37fd1ece03b1acb47fbc543ec32d35987b20b6866
// "requestSeed = 0x01" identifies a fixed relationship between // "requestSeed = 0x01" and "sendKey = 0x02" // "requestSeed = 0x03" identifies a fixed relationship between // "requestSeed = 0x03" and "sendKey = 0x04" srv->securityLevel = requestedLevel; r->send_len = UDS_0X27_RESP_BASE_LEN; return kPositiveResponse; }
// Odd: requestSeed else { /* If a server supports security, but the requested security level is already unlocked when a SecurityAccess ‘requestSeed’ message is received, that server shall respond with a SecurityAccess ‘requestSeed’ positive response message service with a seed value equal to zero (0). The server shall never send an all zero seed for a given security level that is currently locked. The client shall use this method to determine if a server is locked for a particular security level by checking for a non-zero seed. */ if (subFunction == srv->securityLevel) { // Table 52 sends a response of length 2. Use a preprocessor define if this needs // customizing by the user. constuint8_t already_unlocked[] = {0x00, 0x00}; return safe_copy(srv, already_unlocked, sizeof(already_unlocked)); } else { UDSSecAccessRequestSeedArgs_t args = { .level = subFunction, .dataRecord = &r->recv_buf[UDS_0X27_REQ_BASE_LEN], .len = r->recv_len - UDS_0X27_REQ_BASE_LEN, .copySeed = safe_copy, };
/** * @brief \~chinese 服务器时间参数(毫秒) \~ Server time constants (milliseconds) \~ */ uint16_t p2_ms; // Default P2_server_max timing supported by the server for // the activated diagnostic session. uint32_t p2_star_ms; // Enhanced (NRC 0x78) P2_server_max supported by the // server for the activated diagnostic session. uint16_t s3_ms; // Session timeout
uint8_t ecuResetScheduled; // nonzero indicates that an ECUReset has been scheduled uint32_t ecuResetTimer; // for delaying resetting until a response // has been sent to the client uint32_t p2_timer; // for rate limiting server responses uint32_t s3_session_timeout_timer; // indicates that diagnostic session has timed out uint32_t sec_access_auth_fail_timer; // brute-force hardening: rate limit security access // requests uint32_t sec_access_boot_delay_timer; // brute-force hardening: restrict security access until // timer expires
/** * @brief UDS-1-2013: Table 407 - 0x36 TransferData Supported negative * response codes requires that the server keep track of whether the * transfer is active */ bool xferIsActive; // UDS-1-2013: 14.4.2.3, Table 404: The blockSequenceCounter parameter // value starts at 0x01 uint8_t xferBlockSequenceCounter; size_t xferTotalBytes; // total transfer size in bytes requested by the client size_t xferByteCounter; // total number of bytes transferred size_t xferBlockLength; // block length (convenience for the TransferData API)
bool RCRRP; // set to true when user fn returns 0x78 and false otherwise bool requestInProgress; // set to true when a request has been processed but the response has // not yet been sent
// UDS-1 2013 defines the following conditions under which the server does not // process incoming requests: // - not ready to receive (Table A.1 0x78) // - not accepting request messages and not sending responses (9.3.1) // // when this variable is set to true, incoming ISO-TP data will not be processed. bool notReadyToReceive;