Monday, March 06, 2017

HOWTO : Install Go Language 1.8 on Ubuntu 16.04 LTS

The current Go version is 1.6 on Ubuntu 16.04. However, the official Go version is 1.8 as of this writing. We need to install Gophers Ubuntu PPA to complete the task.

Step 1 :

sudo add-apt-repository ppa:gophers/archive
sudo apt-get update
sudo apt-get install golang-1.8

Step 2 :

The workspace is "go" at your working directory by default (such as /home/samiux/go).

nano ~/.profile

Append the following lines at the end of the file :

export PATH=$PATH:/usr/lib/go-1.8/bin

Step 3 :

Log out and re-login.


source ~/.profile

Step 4 :

To test if it is working properly :

go version
go env

Step 5 :

Make sure you create the following directories at the "go" workspace :

mkdir -p ~/go/bin
mkdir -p ~/go/src

You build your project, for example "erp", at "~/go/src/erp".

That's all! See you.

Wednesday, March 01, 2017

HOWTO : Watching China and Hong Kong Online TV on Ubuntu Desktop 16.04 LTS

Step 1 :

sudo dpkg -i getdeb-repository_0.1-1~getdeb1_all.deb

sudo apt-get update
sudo apt-get install youtube-dl

Step 2 :

sudo add-apt-repository ppa:djcj/vapoursynth
sudo apt-get update
sudo apt-get install mpv

(A1) Watch CCTV (China) [Most Updated Method]

If you select this method, you are NOT required to do the "Step 1" and "Step 2".

The "CNTVLive2 plugin for 64BitLinux v2.0.0.3" is updated on March 3, 2017 and it solved the force close problem. It plays CCTV Online TV smoothly. After the plugin is installed, you need to bypass the signed add-on problem by using the following way.

WARNING : After doing the following steps, you have a RISK to install malicious Firefox add-on by accident!

At the URL field at the Firefox, type :


Look for the following and double click it to turn it to "false" :


You can click on one of the following links to install the plugin when prompted.

CCTV Live Channel 1
CCTV Live Channel 2
CCTV Live Channel 3
CCTV Live Channel 4
CCTV Live Channel 5
CCTV Live Channel 6
CCTV Live Channel 7
CCTV Live Channel 8
CCTV Live Channel 9
CCTV Live Channel 10
CCTV Live Channel 11
CCTV Live Channel 12
CCTV Live Channel 13
CCTV Live Channel 14
CCTV Live Channel 15
CCTV Live Channel 5+

* make sure Flash is installed and enabled
* some channels are copyrighted and only plays in China Region

(A2) Watch CCTV (China) [Outdated Method]

If you select this method, you need to do "Step 1" and "Step 2".

You need to install Firefox add-ons, namely watch-with-mpv.

CCTV Live Channel 1
CCTV Live Channel 2
CCTV Live Channel 3
CCTV Live Channel 4
CCTV Live Channel 5
CCTV Live Channel 6
CCTV Live Channel 7
CCTV Live Channel 8
CCTV Live Channel 9
CCTV Live Channel 10
CCTV Live Channel 11
CCTV Live Channel 12
CCTV Live Channel 13
CCTV Live Channel 14
CCTV Live Channel 15
CCTV Live Channel 5+

Optional settings :
Preferences -- Additional playr parameters
--buffer-size 2048 --no-check-certificate --skip-unavailable-fragments --sleep-interval 0.05 --max-sleep-interval 0.5 --limit-rate 2M

* make sure Flash is installed and enabled
* some channels are copyrighted and only plays in China Region

(B) Watch ViuTV (Hong Kong)

If you select this option, you need to do "Step 2" only.

nano viutv

Append with the following content and save it.

To run :



That's all! See you.

Friday, February 10, 2017

HOWTO : Ajenti 1.x on Ubuntu Server 16.04 LTS

Ajenti is an Admin Control Panel for your Linux server. However, Ajenti 2.x is buggy and it is not working properly when I am testing it. Fortunately, Ajenti 1.x still working for Ubuntu 16.04 LTS even it's documentation is written for Ubuntu 12.04.

You can access your Linux server via web browser instead of SSH.

Step 1 :

wget -O- | sudo apt-key add -

Step 2 :

sudo touch /etc/apt/sources.list.d/ajenti.list
echo "deb main main ubuntu" | sudo tee -a /etc/apt/sources.list.d/ajenti.list

Step 3 :

sudo apt-get update && sudo apt-get install ajenti

sudo systemctl restart ajenti

Step 4 :

To access Ajenti, you open the broswer and point it to your server IP. Username is "root" and password is "admin".


That's all! See you.

Tuesday, February 07, 2017

HOWTO : Optimize Ubuntu 16.04 LTS and Kali Linux 2016.2 with jemalloc

jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. It is the best allocators for a broad range of demanding applications, and eliminating/mitigating weaknesses that have practical repercussions for real world applications.

Step 1 :

Option 1 : Compile from source (latest version)

*** This option is not recommended for Ubuntu 16.04 LTS Desktop and Kali Linux 2016.2. When using in Ubuntu 16.04 LTS Desktop, Firefox will be crashed when 2 or more instances are opened. Meanwhile, Kali Linux 2016.2 requires redis-server which is using stock version of libjemalloc1 by default. redis-server for Ubuntu 16.04 also requires stock version of libjemalloc1.

git clone
cd jemalloc
make dist
sudo make install

The final files "libjemalloc.*" are located at "/usr/local/lib/".

touch /etc/

echo "/usr/local/lib/" | sudo tee --append /etc/

Option 2 : Install package (usually older version)

This option is recommended for Ubuntu 16.04 LTS and Kali Linux 2016.2.

sudo apt-get install libjemalloc1 libjemalloc-dev

The final files "libjemalloc.*" are located at "/usr/lib/x86_64-linux-gnu/".

touch /etc/

echo "/usr/lib/x86_64-linux-gnu/" | sudo tee --append /etc/

sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/

Step 2 :

Reboot your box.

Step 3 :

To confirm it is running properly (for example, firefox is running with it) :

sudo lsof -E | grep libjemalloc | grep firefox

That's all! See you.

Thursday, January 26, 2017

HOWTO : Configure Network Interface For Better Performance on Ubuntu 16.04 LTS

Intel network interface card is configurable. Some other brands can but Realtek do not.

(0) You need to install ethtool if it is not :

sudo apt-get install ethtool

(1) List out the available network interface on your system :

ls /sys/class/net

enp1s0f0 enp1s0f1 enp7s0 enp8s0 lo

(2) To see if the network interface can pause the transmission when neccessary or not in order to prevent packet drop :

ethtool -a enp1s0f0

Pause parameters for enp1s0f0:
Autonegotiate: on
RX: on
TX: on

If the values are not "on", you can set it to :

sudo ethtool -A enp1s0f0 rx on tx on

(3) To see if the buffer is at the maximum value or not :

ethtool -g enp1s0f0

Ring parameters for enp1s0f0:
Pre-set maximums:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096
Current hardware settings:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096

If the current hardware settings values are not as the Pre-set maximums, you can set them to be :

sudo ethtool -G enp1s0fo rx 4096 tx 4096

(4) If your network interface cannot be configure like Intel, you may see the following result :

ls /sys/class/net

enp2s0 enp3s0 lo wlp4s0

ethtool -a enp2s0

Pause parameters for enp2s0:
Cannot get device pause settings: Operation not supported

(5) Finally, you can put those commands at /etc/rc.local and run the following command to activate the values :

sudo bash /etc/rc.local

That's all! See you.

Thursday, December 29, 2016

HOWTO : Configure OpenVPN on Ubuntu 16.04

There is a very good article by Digital Ocean for setting up OpenVPN on Ubuntu 16.04. After the above setup, you are required to further configure it to make it working properly.

The following additional settings is to allow all VPN clients can use the same certificate to login the VPN server. Meanwhile, it also allow the maximum concurrent users to 100.

sudo nano /etc/openvpn/server.conf

Uncomment (remove ";") the following :


max-clients 100

That's all! See you.

Wednesday, December 28, 2016

HOWTO : Build An Affordable Intrusion Detection And Prevention System For Home Users

What is Intrusion Detection And Prevention System?

Intrusion detection and prevention system (IDPS) monitors incoming and outgoing traffic on your network and blocks the malicious traffic (packets) based on rules (blacklists).

Why home users need IDPS?

Not only big companies need IDPS but also home users as long as they are connecting to the internet. Almost all home users installed anti-virus but it is not enough. They do need more protection against the cyber criminals.

However, most IDPS appliances are very expensive for home users. Most open source solutions are also demanding for them as they do not familiar with networking and technology.

What is Almond Croissants and Why?

Almond Croissants is an open source intrusion detection and prevention system which is based on Suricata engine. Suricata is the next-generation IDPS engine with a lot of outstanding features.

Users of Almond Croissants are not required to be familiar with networking and technology. It is designed for them in mind. Not only that, it is designed for low-end hardware too. It is really "Plug, Play and Forget!".

What are the key features of Almond Croissants?

- Block ports and vulnerabilities scanning
- Block known exploitation on vulnerable systems
- Block known malicious IP addresses to access your systems
- Block known source of Secure Shell (SSH) brute forcing
- Block The Onion Router (TOR) to access your systems
- Prevent from accessing known malicious sites with Secure Sockets Layer (SSL) certificates
- Prevent from being infected by known virus and malware
- Block known annoying advertising servers
- Easy and straight forward analysis with charts on web interfaces
- Compatible with Bittorrent and 4K video streaming
- Ultra-low latency for online gaming
- Compatible with Windows, Linux, macOS, Apple iOS and Android
- Ultra-low latency throughput that drives your network to a limit
- No subscription fee
- More protection for web servers
- More protection from known malware
- Block known phishing sites
- Automatically update and upgrade
- Plug, Play and Forget!

What hardware is required?

If you have a small family with 4 members and have about 200-250Mbps bandwidth, Zotac Mini PC CI323 (Intel Celeron N3150 with 16GB RAM) is recommended. Meanwhile, you may also require a USB 3.0 Gigabit Ethernet dongle. Yes, 16GB RAM. The vendor states that it supports up to 8GB RAM, however, you can install a total of 16GB RAM on it. A 320GB hard drive is also required. It requires a total of 3 network interface cards. The price of the system is below $400-USD. It is low power consumption for long run.

More powerful CPU and more memory are recommended for demanding situation. Almond Croissants is running on dedicated hardware. The minimum requirements for Almond Croissants is 2-4 CPU threads and 16GB RAM.

How to install?

Since ultra-low latency of Almond Croissants, it is recommended to put Almond Croissants between modem and router. Furthermore, you can install it between router and switch too. However, if you have a wireless router, it is recommended to put Almond Croissants in front of the wireless router.

First of all, you need to install Ubuntu Server (LTS edition) on the box. SSH server is recommended to be installed for remote management inside your network. It may need 8 or more hours to install Almond Croissants on Zotac Mini PC CI323. Make sure the box is connecting to the internet as it fetches the packages and data from various servers in the internet.

The installation procedure is well documented on the Almond Croissants official site. It is easy but it kills time.

After the installation, you can plug the Zotac Mini PC CI323 between modem and router. The USB Ethernet Card is connecting to switch. A reboot is required. It needs about 10 minutes to let all the rules and data load into the memory once boot up.

What's next?

Make sure firewall on your router is enabled and do not allow SSH port to be accessed outside your network unless it is well protected. Anti-virus program to be installed on every computer is optional but is recommended.

For further protection on your laptop and smartphone outside your home, you are required to setup a VPN inside your network. When you are using laptop at coffee shop or using smartphone on the road, you can connect to your VPN and your connection will be protected by Almond Croissants.

All rules and upgrade will be conducted during mid-night between 0100 and 0800 hours. Therefore, the box requires running 24/7/365 and server grade hardware is recommended.

See also

Almond Croissants - Intrusion Detection And Prevention System
Zotac Mini PC C Series
Suricata IDPS Engine
Hardening Mobile Devices with Intrusion Prevention System
Know Your Enemies and Know Yourself
OpenVPN official site
How To Set Up an OpenVPN Server on Ubuntu 16.04
Configure OpenVPN on Ubuntu 16.04
Intel Celeron N3150 Specifications

That's all! See you.

Tuesday, December 13, 2016

Know Your Enemies and Know Yourself


Sun Tzu's The Art of War (孙子兵法) says "If you know your enemies and know yourself, you will not be put at risk even in a hundred battles. If you only know yourself, but not your opponent, you may win or may lose. If you know neither yourself nor your enemy, you will always endanger yourself." (知彼知己,百战不殆;不知彼而知己,一胜一负;不知彼,不知己,每战必殆。) [source : Wikipedia]

Sun Tzu's The Art of War also says "All warfare is based on deception. Hence, when we are able to attack, we must seem unable; when using our forces, we must appear inactive; when we are near, we must make the enemy believe we are far away; when far away, we must make him believe we are near." (兵者,诡道也。故能而示之不能,用而示之不用,近而示之远,远而示之近。) [source : Wikipedia]


Most internet attack activities based on recon on the target. Recon can be conducted by active and passive methods. Active recon will cause a lot of noise to the target as it will collect information from the target directly while passive recon does not.

Once attackers gathered valuable information about the target, such as running services and versions on the target. They will launch exploits when there are vulnerable services running on the target. Once success, the target will be compromised and under the control of the attackers.

On the other hand, if there is no running vulnerable services on the target, attackers may launch social engineering attacks against the target, such as phishing mails, phishing sites, phishing phone calls, phishing downloads and etc. Social engineering may lead to compromise of the target as a result.

The captioned mention attacks can be based on randomly selected target or targeted victim. Furthermore, some attacks are directly by botnets which randomly selecting the targets and aimed to the vulnerable running services. Botnet attacks also have active recon stage as mentioned before.

Possible Defense

Besides some of social engineering attacks, we all know that all almost all attacks are following by recon. If attackers cannot get any valuable information from us, we can delay or even prevent the attack.

We all know that nmap can obtain information of the running services on the opening ports. If we can block nmap scanning from the beginning, attackers are required to guess which ports are opened and which services and versions are running on that ports. They cannot go further when they have no valuable information about us. If so, we can delay or even prevent the attacks. However, social engineering attacks may be launched soon by the attackers.

Commercial Solution

Some anti-virus for Windows system and some Unified Threats Management System (UTM) as well as some Intrusion Prevention System (IPS) can block port scanning. However, some of them failed to detect and block the nmap scan when it is scanning with special command flags. Meanwhile, anti-virus software and UTM as well as IPS may require to subscribe the signatures annually. In addition, commercial UTM and IPS are very expensive. It may cost a lot when long run.

Open Source Solution

Suricata and Snort are very famous Intrusion Detection and Prevention engines (IDPS). They are running based on blacklisting. Those blacklists are rules to alert or block the traffic when the traffic meets the criteria. There are open rules and paid rules available in the market. Some IDPS engines users can write their own rules to meet their requirements. However, some of the rules are written wrongly that causing false positive alert or even cannot detect the activities.

Not everyone is IDPS expert. Setting up a working Suricata or Snort appliance is painful. Users are required to troubleshoot all the problems that they are encountered. Sometimes are hardware limitations. Sometimes are false positive alerts/drops. Sometimes are IDPS engines limitations.

Plug, Play and Forget!

Almond Croissants is an open source IDPS based on Suricata engine. It is released under GPLv3 by Samiux since 2012. It is well tested on Windows, macOS, Linux, Apple iOS and Android. Engine and rules are updated automatically when they are available. Users are not required to be very familiar with IDPS. It not only can detect and block nmap scanning without pain but also have many outstanding features that most IDPS omitted. It is tasty and really "Plug, Play and Forget!"

That's all! See you.

Monday, December 12, 2016

HOWTO : Traffic and Attack Map for Suricata

"Traffic & Attack Map for Suricata" is forked from Matthew May's Attack Map at GitHub

"Traffic & Attack Map for Suricata" is modified to work with Suricata's eve.json file. It shows the inbound traffic only which includes normal and attack traffic. It is designed for Python 3 and Ubuntu Server 16.04 LTS. It is also designed to install on the box of Suricata.

The map shows "DROP" or "ALERT" when the traffic is dropped or alerted by Suricata. Meanwhile, other traffic will be shown as its nature (Event Type), such as DNS, TLS, FILEINFO and etc.


"Traffic & Attack Map for Suricata" is released under GPLv3 by Samiux.


(1) Working Suricata dedicate server as IDPS on Ubuntu Server
(2) Python 3.x
(3) Web server with websocket function
(4) Redis server


sha256sum fda369bd246048ce883fabb16e085caa022a492a7e188b4f0c99f37ea4bc8bdb attack-map-0.0.1.tar.gz


Step 1 :

sudo apt-get install python3-pip redis-server
sudo pip3 install tornado tornado-redis redis maxminddb

sudo nano /etc/redis/redis.conf

Change from :

To :

Step 2 :

tar -xvzf attack-map-0.0.1.tar.gz
cd attack-map/geoip-attack-map

cd ..
sudo cp -R geoip-attack-map /var/www

Step 3 :

cd ..
sudo cp attackmap.service /lib/systemd/system/
sudo cp dataserver.service /lib/systemd/system/

sudo systemctl enable attackmap.service
sudo systemctl enable dataserver.service

Step 4 :

cd /var/www/geoip-attack-map/DataServer
sudo nano

Go to :
hq_ip = '' replace "hq_ip" with your external IP address.

cd /var/www/geoip-attack-map/AttackMap
sudo nano trafficline.js

Go to :
var webSock = new WebSocket("ws://");

replace the "" with your Suricata IP.

Go to :
var hqLatLng = new L.LatLng(33.936051, -81.048565);

replace the value of L.LatLng with your location. You can go to to find your Latitude and Longitude values.

Then configure your web server to point the root directory to "/var/www/geoip-attack-map/AttackMap". Make sure you have enabled "websocket" module or function on your web server. Meanwhile, the port for the websocket is 8888 by default.

*** Setting up web server to work with this project is out of scope of this guide.

Step 5 :

Since Redis server requires this setting to avoid performance issue, you need to edit the boot parameter in Grub.

sudo nano /etc/default/grub

sudo update-grub

sudo reboot

Step 6 :

Once boot up, you can point your browser to the IP address that you entered in the above steps.


If there is no traffic on the map, it is properly the not working. Restart it is required.

sudo systemctl restart dataserver

*** Please note that it needs time to read the eve.json file from the beginning of the file on every restart.

Please also note that do not refresh or reload the page as it will corrupt the map. You need to restart the browser.


Traffic and Attack Map for Suricata

That's all! See you!

Wednesday, November 23, 2016

HOWTO : EveBox on Almond Croissants and Danish

EveBox is a web based Suricata "eve" event viewer for ElasticSearch. ElasticSearch is installed on Almond Croissants or Danish by default. However, EveBox is not installed by default. You need to install it yourself.

Almond Croissants is an Intrusion Detection and Prevention System while Danish is an Intrusion Detection System. Almond Croissants and Danish are created based on Suricata by Samiux under GPL version 3.

In general speaking, EveBox is for advanced Almond Croissants or Danish users.

Step 1a :

sudo cp evebox-0.5.0-linux-amd64/evebox /usr/bin/


Step 1b :

wget -O
sudo cp evebox-0.6.0dev-linux-amd64/evebox /usr/bin/

Step 2 :

sudo nano /lib/systemd/system/evebox.service

Description=EveBox Web Interface

ExecStart=/usr/bin/evebox -e http://localhost:9200


Step 3 :

sudo systemctl enable evebox.service
sudo systemctl start evebox.service

To access it, use your browser to surf :

http://[Almond Croissants IP address]:5636

Update or Upgrade

sudo systemctl stop evebox.service

Repeat Step 1a or 1b.

sudo systemctl start evebox.service

That's all! See you.

Sunday, November 13, 2016

[Review] MIUI 8

To more understand the features of MIUI 8, you need to watch this video.

That's all! See you.

Wednesday, November 09, 2016

[Review] Xiaomi Redmi Note 4

Briefed Specifications

CPU : MTK Helio X20 2.1GHz (10-core)
Storage : 64GB
GPU : Mali T880 MP4 700MHz
Display : 5.5 inches
Resolution : 1080x1920 pixels
Case : Metal
Battery : 4100mAh
Mobile : 4G/LTE (dual SIM or SIM with microSD)
OS : Android 6.0
NFC : Nil

Xiaomi Redmi Note 4 is a China brand Android smartphone which is released in October 2016. It's user interface is MIUI 8. Redmi Note 4 has the following outstanding features :

(A) Anti-Virus

It is pre-installed with anti-virus apps and you can choose either "AVL" or "Tencent" definitions. Meanwhile, you can choose both of them too. If you enabled "Scan before installing", all apps will be scanned before installing. The virus definitions will be updated automatically.

(B) Backup and Restore

By default, "Mi Account" is not enabled. You need to register an account. When you registered, your phone will be fully backup to "Mi Cloud" automatically. Meanwhile, you can restore from "Mi Cloud" when necessary.

(C) Featured tools

Some tools are pre-installed, such as real "FM Radio", barcode "Scanner", audio "Recorder", "Compass" which are grouped at "Tools" icon. Furthermore, "Mi Remote" which is an IR remote controller for TV or similar. "Mi Remote" is grouped at "More Apps" icon. In addition, "Mi Mover" which is situated at "Settings" >> "Additional settings" can move apps and data from old phone (Xiaomi for sure) to new Xiaomi phone.

(D) Blacklist

You are not required 3rd party blocker for the telephone and SMS as it is pre-installed and it is situated at "Security" icon. It can block by telephone number, telephone number prefix or contacts.

(E) Quick ball

A quick access and customizable button on the screen (you can move it anywhere on the screen). It is disabled by default. You can enable it by "Settings" >> "Additional settings" >> "Quick ball". Once it is enabled, the default "Quick ball" has "Home", "Menu", "Lock", "Screenshot" and "Back". You can customize it at your will.

(F) Other features

It has some other features, such as "Lite mode" for elderly, "Second Space" for one phone with two different settings. It likes that you have two devices on one phone. "Second Space" is situated at "Settings". You can unlock the phone with your fingerprint. In addition, it can clear the cache when the phone is locked for a certain time, such as 30 minutes by default for battery saving.

(G) Special features

You need to use default "Clock" apps instead of installing Google's one. Otherwise, the alarm will not activate automatically.

Since it will kill apps for a certain time (3 days by default) in order to free up the memory, some apps that sending notification to other device (such as sports watch) via bluetooth will be dropped after the auto-clean. Meanwhile, when your phone is locked for 30 minutes (default), the battery saving function will clear the cache. However, it will also kill the running apps that sending notifications. Therefore, you need to configure it as at here manually. By the way, it does not come with NFC.

(H) MIUI 8 Review In-Depth

The review of MIUI 8 is here

That's all! See you.

Monday, November 07, 2016

HOWTO : Redmi Note 4 with Garmin fenix 3 HR Notification

Redmi Note 4 is new released China brand Android smartphone. Since MIUI 8 user-interface will kill the Apps in the memory in a certain time (such as 3 days by default), your Garmin fenix 3 HR will not receive any notification (such as Telegram or Whatsapp) via Redmi Note 4 after the auto clean up.

However, this default settings can be changed and the notifications will working.

Option 1 (Stupid way) :

(1) Security icon >> Settings >> Cleaner >> Clean automatically >> Items to clean

Disable "Cache", "Packages" and "Residuals".

(2) Security icon >> Settings >> Scan app memory


(3) Security icon >> Settings >> Battery usage >> Clear cache when device is locked

Set to "Never".

(4) Security icon >> Permissions >> Autostart

Enable "Connect", "Telegram" or "Whatsapp", "Voice Caller ID".

(5) Connect icon >> Settings >> Smart Notifications

Add and enable "Telegram" and/or "Whatsapp".

(6) Settings icon >> Bluetooth

Make sure fenix 3 HR is paired with the phone and bluetooth is enabled.

Option 2 (Smart Way) :

(A) Tap on the "Menu" key at the left bottom corner on the phone. Some running apps screens will be displayed. Swipe down the app screens (such as "Connect", "Telegram", "Whatsapp", "Voice Caller ID") and select "Lock" to prevent the apps from being killed by "Cleaning" feature. The "locked" apps will be running in the background unless you unlock it.

(B) Connect icon >> Settings >> Smart Notifications

Add and enable "Telegram" and/or "Whatsapp".

(C) Settings icon >> Bluetooth

You may also need to do the following for some apps :

(D) Security icon >> Permissions >> Autostart

Enable "Connect", "Telegram" or "Whatsapp", "Voice Caller ID".

Make sure fenix 3 HR is paired with the phone and bluetooth is enabled.

That's all! See you.

Monday, October 10, 2016

[RESEARCH] Cloudflare Can Be Bypassed

About two years ago, CEO of Cloudflare (cloud based Content Delivery Network, CDN) visited Hong Kong to promote their services after an unofficial referendum site (hosted by anti-government party), which is protected by Cloudflare, is under DDoS attack with about 400GB traffic. From that day, Cloudflare is well known to all anti-government parties in Hong Kong. Most of their websites are then protected by it.

This cloud based CDN service provides DDoS protection and the real IP address of the websites are hidden by purpose. Cloudflare has free and paid plans. The paid plan is equipped with Web Application Firewall (WAF). However, this plan is not cheap, so some of the anti-government websites are not in the plan.

When you google the keyword "cloudflare bypass", it returns a lot of pages that are mentioning how to find out the real IP address of the websites that protected by Cloudflare. However, most websites are configured not to present their content properly when browsing it with IP address. Therefore, to find out the real IP address of the website is not the way to bypass Cloudflare unless you want to attack the web server instead of the web application. Meanwhile, to find out the real IP address of the web servers are not easy as it is hidden properly recently.

To pentest those sites, you cannot use Web Vulnerability Scanners, that without WAF evasion feature, as they will be blocked. WAF evasion features for the scanners are not common in the market. You need to pentest those sites manually. Once you find something interesting and suspect it is vulnerable to SQL injection, you need to confirm it with other SQLi takeover tools, such as SQLMap. No matter it is pentesting by manual or SQLMap, you need WAF evasion skill to complete.

Meanwhile, Wordpress is very famous in Hong Kong too. If the target is a Wordpress site, make sure you do not use WPScan to scan it as your IP address will be banned for sure. Once your IP address is banned, you are no way to do the pentesting.

I conduct a research for bypassing Cloudflare with SQLMap and it is successfully with WAF evasion technique. No matter it is free or paid plan, Cloudflare can be bypassed for sure. I am not working for Cloudflare and I do not want to get any bounty. Therefore, I am not going to share my detailed research here as it will alert Cloudflare to improve their WAF when it is disclosed. I am sure that some other researchers out there are already bypassed Cloudflare too. Meanwhile, other OWASP Top 10 and other cloud based WAFs are not tested in this research.


(1) Cloudflare
(2) OWASP Top Ten Project

That's all! See you.

Thursday, September 22, 2016

HOWTO : Hardening Mobile Devices with Intrusion Prevention System

The internet security of mobile devices (such as smartphone, tablet and laptop) becomes very important today. How to secure them is a big problem. Since the cost of anti-virus per device is not cheap per month, most users installed free version of such apps (or programs). However, free version protects the devices on demand purpose only. When you have many mobile devices, you will push your hairs out to secure them. Meanwhile, anti-virus apps (or programs) are designed to prevent your devices from being infected by malware only. They cannot protect you from being attacked by web based attacks, such as Cross-Site Scripting (XSS) and Phishing attacks.

Not all browsers can protect you from being attacked by XSS and phishing by default or by plugins. Most Unified Management Systems (UTM) (or namely Next Generation Firewall) are equipped with anti-virus, spam blocker, web filter, advertising blocker, firewall, intrusion prevention and phish blocker. However, not all UTMs have a good intrusion prevention system.

Not all Intrusion Prevention Systems (IPS) can detect XSS, Phishing, spam, virus, advertising and web filtering. If you have a UTM or IPS that have all the mentioned protection, you can secure your mobile devices by installing a VPN server, such as OpenVPN. Some UTMs have VPN but it does not allow users to connect to the internet from it.

Mobile devices connect to your network, which is hardening by UTM or IPS, via VPN. The mobile devices can surf the internet just like inside your network. As a result, the mobile devices are protected by the UTM or IPS as well.

Open Source project, Almond Croissants, is an Intrusion Prevention System that has all the captioned protection. However, it is not a silver bullet. As I always say, "The risk is not your system vulnerable, the risk is you think that your system is secured".

By the way, make sure you disable the sharing function on your mobile device if any.


(1) Almond Croissants - Intrusion Detection and Prevention System
(2) How To Set Up an OpenVPN Server on Ubuntu 16.04

That's all! See you.

Saturday, September 10, 2016

Firefox 48.0 Does Not Vulnerable To Reverse Tabnabbing

What is Tabnabbing?

According to Wikipedia, Tabnabbing is a computer exploit and phishing attack, which persuades users to submit their login details and passwords to popular websites by impersonating those sites and convincing the user that the site is genuine.

The attack's name was coined in early 2010 by Aza Raskin, a security researcher and design expert. The attack takes advantage of user trust and inattention to detail in regard to tabs, and the ability of modern web pages to rewrite tabs and their contents a long time after the page is loaded.

Tabnabbing operates in reverse of most phishing attacks in that it doesn’t ask users to click on an obfuscated link but instead loads a fake page in one of the open tabs in your browser.

What's New?

Recently, security researcher(s) find a new attack vector. A lot of websites are coding their links with target="_blank" and attackers can use of this vulnerability to attack clients browser.

How to avoid from that?

If you are website administrators or developers, please correct all the code from :


to :

target="_blank" rel="noopener noreferrer"

If you are users/clients, you need to use a not vulnerability browser such as Firefox 34.0 or higher.

I tested Edge, Chrome, Safari and Firefox on Android, Linux, iOS, Windows and Mac OSX. I got the following result.

Vulnerable -
Safari for Mac OSX 9.1.3 (11601.7.8)
Safari for iOS (iPad) 9.3.5
Safari for iOS (iPhone) 9.3.5
Android Browser 42.0.2311.1179 (Default browser for OnePlus One 6.0.1)
Chrome for Mac OSX 53.0.2785.101
Chrome for Android 52.0.2743.98 (Default browser of Nexus 5 6.0.1)
Chrome for Android 53.0.2785.97
Chrome for iOS (iPad) 53.0.2785.86
Firefox for iOS (iPad) 5.2 (1)*

Not Vulnerable -
Firefox for Android 48.0
Firefox for Linux 48.0
Firefox ESR for Linux 45.3.0
Firefox for Mac OSX 48.0
Edge for Windows 25.10586.0.0

Please note that Google will not fix this "vulnerability" on Chrome, please see their explanation here.

*Another thing you may note that Firefox for iOS is also vulnerable. Meanwhile, Chrome for Linux is not tested.

How do I test my browsers?

Please go to Blankshield & Reverse Tabnabbing Attacks Demo Page. If you see the following message on the first line, your browser is not vulnerable. Otherwise, your browser is vulnerable to this attack.

"You are not using a vulnerable browser."

If your browser is vulnerable to this attack, the page should be looking like this.

Demo Video



That's why I love Firefox so much!

That's all! See you.

Friday, August 19, 2016

HOWTO : Oracle Ksplice on Ubuntu 16.04 LTS

Oracle Ksplice provides kernel updates on Ubuntu and Fedora Linux without reboots free of charge. Ksplice is working properly on Desktop and Server versions as it has graphic and command line interfaces.

This guide shows you how to install Ksplice on Ubuntu 16.04 LTS (Desktop or Server version)

Step 1 :

sudo apt-get install libgtk2-perl consolekit iproute libck-connector0 libcroco3 libglade2-0 libpam-ck-connector librsvg2-2 librsvg2-common python-cairo python-dbus python-gi python-glade2 python-gobject-2 python-gtk2 python-pycurl python-yaml dbus-x11

Step 2 :


sudo dpkg -i ksplice-uptrack.deb

Step 3 :

sudo nano /etc/uptrack/uptrack.conf

Change the following as is :

autoinstall = yes

Step 4 :

Usages on CLI :

sudo uptrack-upgrade -y


User Guide

That's all! See you.

Thursday, August 18, 2016

HOWTO : Hardening and Tuning Ubuntu 16.04 LTS

This guide will lead you to hardening and tuning your Ubuntu 16.04 in a few steps without any expense. As an Information Security Enthusiast, my Ubuntu box is setting up like the following and I use the box every day.

Kernel Hardening and Tuning

Make sure you enabled the "No Execute (NX)" or "Execute Disable (XD)" in the BIOS/UEFI.

sudo nano /etc/sysctl.conf

To make it looks like the following :

To reload it :

sudo sysctl -p

ARP Spoofing

One of the common attacks is Man In The Middle attack. It can use with browser attack too. This guide will help to protect your Ubuntu from being spoofing. Meanwhile, make sure to set ARP related settings in your router if the feature is available. Most home routers have no such feature.

HOWTO : ArpON on Ubuntu 16.04 LTS


Most Linux users (including advanced users) misunderstand that Linux will never and impossible to infect with malware. However, it is not true. Almost all operating systems are facing to the threats.

HOWTO : ClamAV 0.99 on Ubuntu 16.04 LTS

This guide will lead you to set up ClamAV for "Scan On Access" instead of "Scan On Demand".

Storage Performance Tuning


Verify TRIM is supported :

sudo hdparm -I /dev/sda | grep TRIM

If the output is similar to the below which is supported :

* Data Set Management TRIM supported (limit 1 block)

If you install your Ubuntu in LVM, the TRIM is usually enabled by default. You can confirm it :

cat /etc/lvm/lvm.conf | grep issue_discards

If the output is similar to the below which is enabled :

issue_discards = 1

Then set the following to "deadline" if it is not done yet.

cat /sys/block/sda/queue/scheduler

noop [deadline] cfq

If not, set it :

sudo nano /etc/rc.local

Insert the following before "exit 0" :

echo 1024 > /sys/block/sda/queue/read_ahead_kb
echo 1024 > /sys/block/sda/queue/nr_requests
echo deadline > /sys/block/sda/queue/scheduler

* make sure your device is sda (or sdb ...)

To reload it or reboot your system :

sudo /etc/rc.local

After that, you need to edit the partition table (/etc/fstab) :

To make it looks like the following :

/dev/mapper/ubuntu--vg-root / ext4 noatime,nodiratime,norelatime,errors=remount-ro 0 1

sudo mount -a
sudo mount -o remount /

If you have an error after running the captioned commands, DO NOT reboot your system. You should correct the typo before doing so; otherwise, you cannot boot to your system again.

You can add "scsi_mod.use_blk_mq=1" to kernel parameter, such as "/etc/default/grub".

(B) Hard Drive

sudo nano /etc/rc.local

Insert the following before "exit 0" :

echo 1024 > /sys/block/sda/queue/read_ahead_kb
echo 1024 > /sys/block/sda/queue/nr_requests

* make sure your device is sda (or sdb ...)

To reload it or reboot your system :

sudo /etc/rc.local

After that, you need to edit the partition table (/etc/fstab) :

To make it looks like the following :

ext4 noatime,nodiratime,norelatime,errors=remount-ro 0 1

sudo mount -a
sudo mount -o remount /

If you have an error after running the captioned commands, DO NOT reboot your system. You should correct the typo before doing so; otherwise, you cannot boot to your system again.

Firefox Hardening and Tuning

Most malicious attacks nowadays are via browsers. Therefore, we need to protect ourselves even we are using Linux.

(A) Apparmor For Firefox

AppArmor is a Linux Security Module implementation of name-based access controls.

sudo apt-get update
sudo apt-get install apparmor-utils apparmor-profiles

To make it looks like the following and it is compatible to Firefox 51.0.1 or later :

sudo rm /etc/apparmor.d/disable/usr.bin.firefox

Reload the rules :

sudo apparmor_parser -r /etc/apparmor.d/usr.bin.firefox

(B) Firefox Add-ons


Allow active content to run only from sites you trust, and protect yourself against XSS and Clickjacking attacks.

* You are not required to enable it as it will block the javascript that most modern websites are using. You need to disable it globally to make the XSS attack protection by default.

uBlock Origin (Optional)

Finally, an efficient blocker. Easy on CPU and memory. (Please refer to the official site for details)

WebRTC Control

Have control over WebRTC (disable or enable) and protect your IP address.


Remove or manage a new and uncommon kind of cookies, better known as LSO's.The BetterPrivacy safeguard offers various ways to handle Flash-cookies set by Google, YouTube, Ebay and others...

HTTPS Everywhere

Encrypt the web! HTTPS Everywhere is a Firefox extension to protect your communications by enabling HTTPS encryption automatically on sites that are known to support it, even when you type URLs or follow links that omit the https: prefix.

Speed Tweaks (SpeedyFox)

This extension provides a list to almost all the settings that you may need to alter in order to enhance Firefox's speed.

(C) Optional

(1) Firefox Add-ons :

User-Agent Switcher

The User Agent Switcher extension adds a menu and a toolbar button to switch the user agent of a browser.

Youtube High Definition

YouTube High Definition is a powerful tool that will let you automatically play all YouTube videos in HD (High Definition), turn off annotations, change video player size, auto stop videos, auto mute videos, control embedded videos and much more.

Youtube Flash-Html5

Play YouTube Videos in Flash or HTML5 Player.

(2) Browse with "New Private Window" feature

Finally, you may consider to use Intrusion Detection and Prevention System (IDPS) to protect your network. My project "Almond Croissants" which is an IDPS that can deploy to your network (in front or/and behind the router). Or, you may also consider to use TOR to protect your privacy with my project "NightHawk".



IP Leak

That's all! See you.

HOWTO : ClamAV 0.99 on Ubuntu 16.04 LTS

Clam AntiVirus (ClamAV) is a free and open-source, cross-platform antivirus software tool-kit able to detect many types of malicious software, including viruses.

This guide will lead you to set up ClamAV for "Scan On Access" instead of "Scan On Demand". It is also target to Desktop usage only.

The current version at this writing is ClamAV 0.99.

Step 1 :

sudo apt-get install clamav clamav-freshclam clamav-daemon libclamunrar7

Step 2 :

sudo nano /etc/clamav/clamd.conf

To make the entries looking like the following. Make sure to replace "samiux" with your username.

cd ~
mkdir quarantine

Step 3 :

sudo nano /etc/clamav/freshclam.conf

To make the entries looking like the following.

sudo systemctl enable clamav-daemon
sudo systemctl restart clamav-daemon
sudo freshclam

Remark :

Download or copy will not trigger the ClamAV scan but browsing or executing (or etc) will. If any malware or virus (no matter it is for Windows, Linux or Mac OSX) is detected, it will be moved to "quarantine" directory. You can also check the log at "/var/log/clamav/clamav.log". Be aware that ClamAV may produce a lot of false positive warning in Linux.

Testing :

You can install NO harm virus testing files for testing.

sudo apt-get install clamav-testfiles

The NO harm virus testing files are located at "/usr/share/clamav-testfiles".


AppArmor Wiki

That's all! See you.