未加星标

Own automatic phishing list and Tor-to-Tor tunneling

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二04 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏
Getting own malwarelists

Many extensions like uBlock will provide you with curated lists of malicious URLs and domains. This is easy to use and will stop most bad things from happening. But what if you wanted to have your own updates that do not have to take time to trickle down through the curators, then the periodic list updates? Is there a way to get recent bad domains if you’re not an operator of a large network with many users on it, and do not have a huge honeypotproject?

Yes! Because you can be a large network operator in just a few hours. There are thousands of people who will be happy to send you their traffic. And even though they seem to want better anonymity, in general they don’t seem very security concious. I’m talking of the Tor network of course, where anyone can become an exit node operator and get a random, possibly very biased, very small chunk of global webtraffic.

Thesetup

What I’m after are the domains, not the URLs at this point. And only those dedicated to tricking users, not the hijacked ones that just happen to host malware. That means I’m really after the DNS requests that users make. Unfortunately Tor tunnels only the TCP traffic, not UDP , so there’s no way to request only the DNS as the exit traffic. Fortunately it does tunnel the DNS requests usng Tor-specific channel and it sends them to the same exit node you’re sending your other traffic to. This is great, because it means I can advertise a port 80 exit and get all the related DNS requests at the sametime.

This can be done by adding the following to thepolicy.

ExitPolicy accept *:80

Now both the requests and the HTTP traffic will be sent to you. The amount of received requests depends only on the advertised bandwidth. In practice if you advertise 1Mbyte link, you can expect ~4000 DNS requests per hour. Not a huge amount, but it is a decentsample.

Thesafety

Now what if you want to reproduce this without actually being responsible for other peoples’ traffic? The Tor information is pretty carefree telling everyone that it’s great to run a Tor exit. But in practice that can result in either your internet access, or your server being cancelled and potential LEA interactions. So when collecting the data, I didn’t really want to send anyone’s traffic from myconnection.

To work around that I decided to send all the received traffic through a safe network instead. One that would still get to the destination, but encrypt all the data and not expose the source. Specifically through the Tornetwork!

The official Tor client doesn’t really allow you to split the exit and the onion router traffic to different interfaces, but that can be fairly easily fixed in the source. With that in place, you can split the exit traffic to a dummy interface - one which is isolated bydefault.

modprobe dummy ip addr add 10.0.0.1 dev dummy0 echo "OutboundBindAddressExit 10.0.0.1" >> /etc/tor/torrc

The final part is to redirect all the relevant DNS requests and all the traffic back to the Tornetwork.

echo "nameserver (own resolver)" >> /etc/tor/resolv.conf echo "ServerDNSResolvConfFile /etc/tor/resolv.conf" >> /etc/tor/torrc iptables -t nat -A OUTPUT -s 10.0.0.1/32 -p tcp -m tcp -j DNAT --to-destination 10.0.0.1:9999

Quality of thedata

Now that we can capture all the data, how can I tell that it’s a representative sample of real internet traffic? I can’t, not easily anyway. One way is just browsing the list for known names and more specificaly looking at histograms for usual features. The top looks likethis:

311 category.auctions.yahoo.co.jp. 256 ((censored)) 189 www.google.com. 185 clients1.google.com. 176 www.google-analytics.com. 173 closedsearch.auctions.yahoo.co.jp. 142 wing-auctions.c.yimg.jp. 135 google.com. 116 fonts.googleapis.com. 110 ocsp.digicert.com. ....

Looks like someone didn’t have DNS caching turned on for the yahoo auctions, or there was some serious interest in scanning them. But otherwise it checks out - with the added irony of google analytics being a popular domain accessed from the Tornetwork.

What about the longtail?

# awk '{print $9}' < domains.list | sort | uniq -c | sort -nr | grep -c ' 1 ' 25344 # wc -l domains.list 45468 domains.list

Around half of the domains were resolved only once. Pretty similar to my home network. I’m not going to pretend this is the best possible source of data, but for a proof of concept, it’s good enough. It’s likely to be noisy (cached -vs- not cached entries), it will miss a lot of known phishing domains due to adblockers (that’s actually good, I’m only going to see what’s not filtered yet), it will have a different profile than the open internet (a number of people on Tor will filter a lot oftraffic).

Phishing domains,finally

With all that data, I started from just selecting things that stood out and then forming a few rules for easy classification of new traffic. The rules here are not supposed to be 100% correct, they just add points. (like spamfilters)

Whitelist

To quickly reject false positives, I whitelisted some domains. This removes them completely as trusted. (from the phishing perspective anyway) Google, Apple, Yahoo, Amazon, and other domains with known country TLDs aredropped.

Longlabels

What really stands out if some domain consists of more than 3-4 labels. Standard pages usually try to avoidit.

# awk '{print $9}' < domains.list | tr -d 'a-z0-9-_:' | sort | uniq -c 31 . 14239 .. 24255 ... 4896 .... 1534 ..... 86 ...... 344 ....... 11 ........ 12 ......... 9 .......... 14 ........... 30 ............ 6 ............. 1 ........................

With winners looking likethis:

www.apple.com.(random).(random).(random).(random).(random).(random).isecure.com.my

So let’s give it 2 point for each domain over 3 labelslong.

HiddenTLDs

From the previous example we can see the name tries to impersonate apple.com. I could go with the company list again, but instead I’ll check for the popular TLDs which are in the middle of the name. 3 points for each TLD not in the last 2labels.

L33tsp33k

Another pattern spotted in entries from the previous list is that some domains try to use misspelling to prevent easy discovery. Forexample:

paypai.com-resolvedlimited.com

So the next rule is to replace all “1”, “0”, “i” (none of the known names happen to include “i”) with “l” and “o”. If a company name appears, 10 points to thatdomain.

Garbagelabels

Finally some labels themselves are either too long, or random. The length is easy - 1 point for each character over 16. The randomness is harder. For the purpose of this exercise, I’ll just assume that random means not similar to english-like words. Or specifically, if it contains 2-tuples of letters not found in local system dictionary. The list of tuples is filtered a bit - by default there are 588 of them, but if you include only those available in at least 0.1% of words it’s only372.

This allows to pick out labels like “qkjv4fgxgcr

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: AppleUT
分页:12
转载请注明
本文标题:Own automatic phishing list and Tor-to-Tor tunneling
本站链接:http://www.codesec.net/view/480631.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(48)