關於 Juniper ScreenOS 防火牆被放後門的研究

一樣是從 Bruce Schneier 那邊看到的:「Details about Juniper's Firewall Backdoor」,原始的研究連結在「Cryptology ePrint Archive: Report 2016/376」這邊。

ScreenOS 被放了兩個後門,一個是 SSH 的後門:

Reverse engineering of ScreenOS binaries revealed that the first of these vulnerabilities was a conventional back door in the SSH password checker.

另外一個是「Dual EC 的 Q 值」被放了後門,而「NIST 所制定的 Dual EC 的 Q 值」本身就是個後門,所以有人把這個後門又給換掉了:

The second is far more intriguing: a change to the Q parameter used by the Dual EC pseudorandom number generator. It is widely known that Dual EC has the unfortunate property that an attacker with the ability to choose Q can, from a small sample of the generator's output, predict all future outputs. In a 2013 public statement, Juniper noted the use of Dual EC but claimed that ScreenOS included countermeasures that neutralized this form of attack.

第二個後門更發現嚴重的問題,Juniper 所宣稱的反制措施根本沒被執行到:

In this work, we report the results of a thorough independent analysis of the ScreenOS randomness subsystem, as well as its interaction with the IKE VPN key establishment protocol. Due to apparent flaws in the code, Juniper's countermeasures against a Dual EC attack are never executed.

也因此團隊確認選定 Q 值的人可以輕易的成功攻擊 IPSec 流量:

Moreover, by comparing sequential versions of ScreenOS, we identify a cluster of additional changes that were introduced concurrently with the inclusion of Dual EC in a single 2008 release. Taken as a whole, these changes render the ScreenOS system vulnerable to passive exploitation by an attacker who selects Q. We demonstrate this by installing our own parameters, and showing that it is possible to passively decrypt a single IKE handshake and its associated VPN traffic in isolation without observing any other network traffic.

VPC VPN 的新功能

Amazon VPC 的 VPN 推出新功能了:「EC2 VPC VPN Update – NAT Traversal, Additional Encryption Options, and More」。

其中「Reusable CGW IP Addresses」這個功能讓大家等超久的:(CGW 是 Customer Gateway,通常是放在自己的機房裡跟 Amazon VPC 設 site-to-site VPN 對接)

You no longer need to specify a unique IP address for each customer gateway connection that you create. Instead, you can now reuse an existing IP address. Many VPC users have been asking for this feature and I expect it to be well-used.

之前得弄一堆 IP address 來接來接去,現在總算是改善了...

在攻擊時總是挑最弱的一環:NSA 對 DH 的攻擊

在「How is NSA breaking so much crypto?」這邊提到了 2012 年有文章說明 NSA 有能力解開部份的加密通訊,而後來 Snowden 所提供的資料也證實了這點:

In 2012, James Bamford published an article quoting anonymous former NSA officials stating that the agency had achieved a “computing breakthrough” that gave them “the ability to crack current public encryption.” The Snowden documents also hint at some extraordinary capabilities: they show that NSA has built extensive infrastructure to intercept and decrypt VPN traffic and suggest that the agency can decrypt at least some HTTPS and SSH connections on demand.

但在這之前一直都不清楚是怎麼解出來的,直到最近才猜測應該是 Diffie-Hellman 的強度以及實作問題:「Imperfect Forward Secrecy: How Diffie-Hellman Fails in Practice」。

而成果其實非常驚人,由於強度不夠以及實作問題,有相當可觀的數量是可被攻擊的:

We go on to consider Diffie-Hellman with 768- and 1024-bit groups. We estimate that even in the 1024-bit case, the computations are plausible given nation-state resources. A small number of fixed or standardized groups are used by millions of servers; performing precomputation for a single 1024-bit group would allow passive eavesdropping on 18% of popular HTTPS sites, and a second group would allow decryption of traffic to 66% of IPsec VPNs and 26% of SSH servers. A close reading of published NSA leaks shows that the agency’s attacks on VPNs are consistent with having achieved such a break. We conclude that moving to stronger key exchange methods should be a priority for the Internet community.

作者群給的建議有三個方向,一個是把長度加長到 2048 bits,另外一個是改用 ECDH,而最差的情況 (如果還是需要使用 1024 bits DH) 則是避免使用固定的 prime number。

Cisco 會將硬體寄送到貨運商,以提高 NSA 攔截安裝後門的難度

在「To Avoid NSA Interception, Cisco Will Ship To Decoy Addresses」這篇看到的報導,出自「Cisco posts kit to empty houses to dodge NSA chop shops」這篇。

去年 Snowden 揭露的資料顯示 NSA 會攔截 Cisco 的硬體,並且在上面安裝後門再打包寄出:「Greenwald alleges NSA tampers with routers to plant backdoors」:

"The NSA routinely receives – or intercepts – routers, servers and other computer network devices being exported from the US before they are delivered to the international customers."

The agency then implants backdoor surveillance tools, repackages the devices with a factory seal and sends them on. The NSA thus gains access to entire networks and all their users.

不過 Cisco 的反應好慢,去年五月就有的消息,現在才提出改善方案。

改善的方法是寄送到集散地,再請人去拿。讓 NSA 之類的單位想要攔截的成本提高。

英國政府對電腦的資安管理機制:Ubuntu 14.04 LTS 的部份

Ubuntu Insights 上看到「UK Government issues Ubuntu 14.04 LTS Security Guidance」,英國政府發布了 Ubuntu 14.04 LTS 的資安規範:「End User Devices Security Guidance: Ubuntu 14.04 LTS」,在裡面甚至還包括了 script 幫你處理。

可以在「End User Devices Security and Configuration Guidance」的「Per-platform Guidance」看到其他作業系統的資安管理規範。

在企業規劃內部的資安規範時也可以拿來參考看看?

用 Facebook Chat 當作 VPN tunnel...

在同一天的 Hacker News Daily 上看到這兩篇,這是怎樣 XDDD:

RMS 對 Facebook 的意見就不提了,來討論後面這個專案:

The idea of this project is to tunnel Internet traffic through Facebook chat (packets are sent as base64), the main component is tuntap and also the Google's Gumbo parser which does the interaction with Facebook (login, send/receive messages, etc.).

用 C++ 寫的... 不過 Facebook 可以通的環境通常可以有其他的 VPN 選擇吧 @_@

利用 WebRTC 取得瀏覽器端的 IP address

TorrentFreak 上看到的:「Huge Security Flaw Leaks VPN Users' Real IP-Addresses」。

可以在「https://diafygi.github.io/webrtc-ips/」這邊測試,就算你在 NAT 以及 VPN 後面也可以取得真實的 Public IP 資訊。

Google Chrome 的使用者可以裝「WebRTC Block」阻擋 WebRTC,而 Firefox 則可以透過 about:config 的設定關閉 media.peerconnection.enabled 這個值:

目前還不太會用到 WebRTC,先擋起來之後再說...

Tor 官方預測將會被攻擊

Tor 官方預測將會被攻擊:「Possible upcoming attempts to disable the Tor network」。

透過扣押機器的方式降低 Tor 對 client bootstrap 的承載能力:

The Tor Project has learned that there may be an attempt to incapacitate our network in the next few days through the seizure of specialized servers in the network called directory authorities.

挑弱點打...

介紹 Tails:Privacy for anyone anywhere

來介紹 Tails 這個以隱私為重點而設計出來的環境。

Tails 是一個獨立的作業環境,以 Debian 打造,並且使用 Tor 保護隱私,另外透過調整過的 Firefox (在 Debian 裡叫做 Iceweasel) 確保連線的安全。

設計上,整個系統利用 iptables 保護,只允許 Tor 的流量連出去,而其他的程式都是透過環境變數與 proxy 設定連外,所以用 curl (透過環境變數設定 proxy) 可以通,但用 nc 直接連卻不會通:

要注意的是,由於這是使用 Tor 作為隱私保護,所以非 HTTPS 的連線都應該被視為會被竊聽或是加料的環境,請避免使用 Tails 連上 HTTP 網站。

Tails 可以在網站上可以下載 ISO image 安裝,下載完後請務必確認 SHA256 是否正確 (網站上有 SHA256 的值,加上 HTTPS 的網址,直接看網站上的這個 SHA256 值應該還算安全)。

拿到 ISO image 後可以選擇燒成光碟後開機執行,這是官方比較推薦的方法。如果是使用虛擬機執行時,需要確認母虛擬機的主體 (Host) 是安全的。

這邊以 VirtualBox 為例子,選擇 Debian 32bits 然後直接把 ISO image 掛上去:

使用虛擬機時,記憶體開個 1GB 應該是夠用 (我是開 2GB,因為沒有掛硬碟當 crypto swap,記憶體大理論上會順一點),看個人環境而自己選擇。開機後會出現:

放著開進去或是選 Live 進去都可以,接下來會出現登入畫面:

第一次玩可以直接用預設值選 Login 就好。登入進去後可以看到這個畫面:

然後過一陣子後右上角會出現黃色的洋蔥 icon,表示已經連上 Tor:

再等一陣子後右上角的洋蔥就會變成綠色,表示已經順利連上:

瀏覽器開起來預設會連到 Tails 的官方網站:

接下來就可以開始做事了:(這是不良示範,你不應該在匿名 channel 裡面查詢與自己有關的資訊)

到這邊應該有個獨立的環境可以玩了...

用 pfSense 架設 Firewall (以及 NAT)

pfSense 是一套很不錯的 firewall 以及 NAT 服務,上面還可以跑一切服務 (像是 OpenVPN 或是 Squid),不過後來都是用商用的硬體方案來處理...

看到「Build your own pro-grade firewall」這篇突然想到要查 pfSense 是否可以 High Availability,如果做的夠好的話,其實可以用兩台機器來跑,成本相對低很多。

結果查到這篇官方文件「Configuring pfSense Hardware Redundancy (CARP)」,裡面有幾個關鍵字,像是 XMLRPC Sync 似乎暗示了設定也可以同步?

官方文件裡的配置圖。

該測試看看了,兩台 server 也才十萬,但兩台能跑到 500Mbps+ 的硬體防火牆的價錢就貴多了... (不過比較省電?)