[Español] El pasado miércoles 16 y jueves 17 de noviembre tuvo lugar la tercera edición de Source en Barcelona. Quizá yo no sea objetivo ya que formo parte del advisory board, pero tengo que admitir que cada año el congreso se supera.
[English] The past Wednesday 16 and Thursday 17 November was held the third edition of Source in Barcelona. I might not be objective as I am part of the advisory board, but I have to admit that each year the conference exceeds.
A pesar de ser un congreso pequeño tiene unas magníficas charlas y el ambiente es estupendo, se puede hablar con todo el mundo seas ponente o asistente. Lo cierto es que el congreso es un buen lugar para ver a los viejos amigos y por supuesto hacer nuevas amistades y compartir unas cervezas entre risas :)
Despite being a small conference has some great talks and the atmosphere is great, you can talk to everybody no matter if he is speaker or attendee. Indeed the conference is a good place to see old friends and of course making new acquaintances and share a few beers and laughs :)
[Español] En mi trabajo paso la mayor parte del tiempo auditando código y he pensado que sería interesante para el lector contar un poco nuestro proceso y de paso ver cómo lo hacen los demás.
[English] I spend most of the time at work auditing code and I thought it would be interesting for the reader to explain our process and see how others do it.
Como no podía ser de otra manera seguimos el SDL de Microsoft :) y todos los desarrollos internos tienen que pasar una serie de controles de seguridad. Para este artículo nos enfocaremos en la auditoría de código únicamente.
Nuestro proceso es muy fácil de seguir para los grupos de desarrollo, ya que tenemos que tener en cuenta que la gente de seguridad está para ayudar y no complicar las cosas.
En la Fig. 1 podemos ver una versión aproximada del proceso que seguimos, que creo que es muy fácil de entender por lo que no entraré a detallar.
As it could not be otherwise we follow Microsoft SDL :) and all internal developments must pass a series of security checks (security gates). For this article we will focus on code review only.
Our process is very easy to follow for development groups, we must bear in mind that the security teams are here to help and not to complicate things.
In Fig. 1 we can see an approximate version of the process we follow which I think is very easy to understand so I will not explain the detail.
Fig. 1 – Proceso Auditoría de Código / Code Review Process
Una parte importante del SDL son las constantes mejoras a los procesos, herramientas y formación como se puede ver en el punto 14. Esto es fundamental para mantener un buen nivel de seguridad con las últimas tecnologías.
Siguiendo este proceso hace tiempo que desarrollé una pequeña herramienta (lo siento pero no disponible por el momento) para ser más efectivo en auditorías de código llamada WildFire, que incorpora la mayoría de las etapas del proceso anterior.
An important part of the SDL is the continuous improvements to processes, tools and training as you can see in point 14. This is essential to maintain a good level of security with the latest technologies.
Following this process some time ago I developed a small tool (sorry but not available at the moment) to be more effective in code reviews called WildFire which incorporates most of the stages of the previous process.
Lo interesante de WildFire son algunas características como:
Analiza todo el código para obtener líneas de código y comentarios para ayudarnos en la estimación de tiempo, identifica vulnerabilidades (análisis estático básico), clasifica los ficheros en función de tipo, etc.
Genera un informe con los hashes de todo el código para enviar al cliente
Simple UI
Generación de informes
Utiliza un modelo de caja negra en el sentido que no intenta entender o compilar el código y puede analizar distintos lenguajes de programación
The interesting thing about WildFire are some features like:
Analyses code to get lines of code and comments to help us in the estimation of time, identifies vulnerabilities (basic static analysis), classifies files based on type, etc.
Generates a report with the hashes of all the code to send to the client
Simple UI
Report generation
Uses a black box approach in the sense that it does not try to understand or compile the code and can analyze various programming languages
Una parte importante es la estimación de tiempo que nosotros realizamos mediante dos pasos, primero un formulario que recoge información del proyecto a revisar y segundo tras obtener el código utilizamos una tool diseñada para este fin, ya sea WildFire u otras que también disponemos. En OWASP podemos encontrar información sobre métricas en código.
Sin duda contar con un proceso bien detallado y las herramientas adecuadas es fundamental para una auditoria de código aunque no es suficiente, también debemos contar con las personas adecuadas (talento y formación).
Y vosotros como realizáis auditorias de código?
An important part is the estimation of time which we carry out by a two-step process, first a form that collects information from the project to review and second after obtaining the code use a tool designed for this purpose either WildFire or other tools that we also have available. In OWASP we can find information about code metrics.
Without a doubt having a good detailed process and the right tools is essential for a code review although it is not enough, we must also have the right people (talent and training).
[Español] Hace tiempo que quería escribir sobre crackme en Android, ya que son un magnífico ejercicio para aprender técnicas de ingeniería inversa para Apps que luego podemos aplicar para analizar malware o buscar vulnerabilidades ;)
Para este post he pensado que sería interesante comentar algunas herramientas que podemos usar y por desgracia los pocos crackmes que existen para Android. No es mi intención escribir un tutorial de ingeniería inversa, eso lo dejo para el lector!
[English] I have been waiting to write about Android crackmes for a while since they are a wonderful exercise to learn reverse engineering techniques for Apps that we can later apply to analyze malware or to find vulnerabilities ;)
For this post I thought it would be interesting to comment on some tools you can use and unfortunately the few crackmes that exist for Android. It is not my intention to write a tutorial on reverse engineering, that I leave to the reader!
Herramientas / Tools
Como Android es la plataforma de moda para los hackers se han desarrollado diversas herramientas que podemos utilizar y que voy a comentar a continuación.
Android SDK: el kit oficial de Google para desarrollar Apps, donde podemos encontrar utilidades como el Emulador para crear imágenes Android con las que jugar, el ADB, una potente utilidad que nos permite comunicarnos con Android y realizar diversas tareas, así como las herramientas de desarrollo.
Androguard: estupendo kit para realizar ingeniería inversa, está escrito en python por lo que es ideal para escribir scripts
Dex2jar: convierte los binarios de Android (.dex) en ficheros java (.class) para facilitar su análisis
Existen más herramientas pero éstas son un buen comienzo. Aparte en mi caso también utilizo varias herramientas que he desarrollado para esta tarea y que algún día publicaré :)
As Android has become hacker’s playground various tools have been developed that we can use and we will comment below.
Android SDK: the official kit from Google to develop Apps, where you can find utilities as the emulator to create Android images to play with, the ADB, a powerful utility that allows us to communicate with Android and perform various tasks, as well as the development tools.
Androguard: super kit for reverse engineering, is written in python so it’s ideal for writing scripts
Dex2jar: convert Android binaries (.dex) to Java (.class) files to facilitate analysis
There are more tools but the discussed here are a good start point. In my case I also use several tools that I have developed myself for this task, which someday I will publish :)
Crackmes
Como mencioné anteriormente existen muy pocos crackmes de Android, en la actualidad yo sólo conozco 4. Comentaré 2 de los crackmes aunque no daré ninguna solución al reto, y los otros 2 para que el lector se entretenga.
As mentioned previously there are very few Android crackme, I only know 4. I will comment on two crackmes although I will not give any solution to the challenge, and the other two crackmes for the reader’s entertainment.
Crackme1hpys / Crackme1hpys
Los chicos de Hack Players publicaron un reto crackme en diciembre 2010 que consistía en averiguar la contraseña de la aplicación. Aunque superé el reto llegué tarde ;)
En la Fig. 1 podemos ver que al ejecutar el crackme se nos pide un usuario y contraseña que a priori no conocemos. Utilizando las herramientas antes descritas comenzamos el análisis del crackme.
The guys from Hack Players published a crackme challenge in December 2010 which consisted in finding out the username and password for the application. Although I did overcome the challenge I did arrive late ;)
In the Fig. 1 we can see that when you run the crackme it is asking for a username and password that we don’t know. Using the tools described above we start analyzing the crackme.
Fig .1 – Pantalla de inicio / Main screen
En la Fig.2 introducimos un usuario y contraseña al azar para ver qué mensajes nos proporciona el crackme. Muchas veces con los mensajes de error podemos obtener información interesante.
In the Fig.2 we enter a username and password at random to see what messages crackme provides us with. Many times error messages provide interesting information.
Fig. 2 – Contraseña inválida / Invalid password
En este punto hemos analizado el crackme y hemos obtenido el usuario y contraseña correctos como se puede ver en la Fig. 3. Lo cierto es que es un reto fácil aunque entretenido.
Estrategias de análisis: para estos crackmes o incluso cualquier App tenemos dos estrategias principales: análisis estático del código o análisis dinámico manipulando el App.
At this point we have analyzed the crackme and obtained the correct username and password as you can see in the figure 3. It is true this is an easy challenge but entertaining as well.
Analysis strategies: for these crackmes or even any App we have two main strategies: static code analysis or dynamic analysis by manipulating the App.
Fig. 3 – Hemos superado el reto! / Challenge overcome!
Deurus, el alias del autor, publicó 3 crackmes (crackme01, crackme02 y crackme03) aunque por desgracia la página que los alberga y que era un magnífico portal de crackmes ya no está disponible y desde aquí esperamos que vuelva algún día.
Para estos crackmes seguimos el procedimiento del anterior crackme y en la Fig. 4 podemos ver cómo hemos obtenido un valor válido.
Los crackme02 y crackme03 los dejo para que el lector se entretenga :)
Deurus, author alias, published 3 crackmes (crackme01, crackme02 and crackme03) but unfortunately the page containing them that was a magnificent portal of crackmes is no longer available and from here we hope it returns someday.
For these crackmes we follow the procedure earlier described with the above crackme and in the Fig. 4 we can see how we have obtained a valid value.
We leave crackme02 and crackme03 to the reader for his amusement :)
Fig. 4 – Jugando con Crackme01 / Playing with crackme01
Los crackmes han sido siempre un buen ejercicio para aprender ingeniería inversa, análisis de aplicaciones, buscar vulnerabilidades y para algunos quitar protecciones. Hoy en día existen crackmes de todas clases y lenguajes.
Yo sólo conozco estos 4 crackmes para Android por lo que si el lector conoce alguno más le agradeceré que me envíe un email, por favor :)
Qué crackmes recomiendas?
Crackmes have always been a good exercise to learn reverse engineering, applications analysis, how to look for vulnerabilities, and for some remove protections. Today there are crackmes of all classes and languages.
I only know these 4 crackmes for Android so if the reader knows some more send me an email, please :)
[Español] Ya hace más de un año que finalicé mi Executive MBA en una conocida escuela de negocios, que fue una experiencia interesante y enriquecedora, y por otro lado llevo en el mundo de la seguridad informática muchos años en los que he visto casi de todo. Por eso he pensado que para este post sería interesante comentar una carencia que tienen la mayoría de programas MBA en relación con mi carrera profesional.
[English] It has been more than a year since I did finish my Executive MBA at a well-known business school, being an interesting and rewarding experience, and on the other hand I have been working in the world of computer security for many years where I’ve seen almost everything. That is why I thought that for this post it would be interesting to discuss an existing gap in most MBA programs related to my professional career.
En las diferentes asignaturas ves de forma rápida multitud de conceptos sobre operaciones, finanzas, marketing, estrategia, RSC, emprendedores, etc. y si es una escuela moderna seguramente también un curso de tecnología. Es en esta asignatura donde echo en falta algo más de contenido sobre seguridad y privacidad para los tiempos que corren.
In the different subjects you quickly view multitude of concepts from operations, finance, marketing, strategy, CSR, entrepreneurship, etc. and if it is a modern school maybe a technology course. It is in this subject where I miss something about security and privacy concepts for the times we are in.
Las escuelas de negocios proclaman que crean a los líderes del mañana pero en la mayoría de casos estos líderes no salen preparados para abordar un tema como es la seguridad y privacidad. Unos conocimientos básicos son igualmente necesarios que en otras áreas como finanzas, estrategia o marketing para que la compañía goce de una buena salud.
Business schools claim that they create the leaders of tomorrow, but in most cases these leaders do not come prepared to address a topic such as security and privacy. A few basic skills are equally required as other areas such as finance, strategy and marketing for the company to enjoy a good health.
Nadie puede negar que prácticamente todas las empresas del mundo utilizan la tecnología de forma diaria mediante correos electrónicos, blog corporativos, navegación por Internet, redes sociales, dispositivos móviles o la mítica Nube, incluso muchas empresas utilizan la tecnología como palanca de innovación. Sin embargo a pesar de todo este uso la seguridad y privacidad suelen ser temas olvidados por la alta dirección, grave error.
No one can deny that almost all the companies in the world use technology on a daily basis through e-mails, corporate blogs, browsing the Internet, social networks, mobile devices or the mythical Cloud, even many businesses use technology as a lever for innovation. But despite all this security and privacy issues are being neglected by top management, big mistake.
Si algo hemos aprendido en 2011 es que nadie está a salvo de ser atacado: empresas como RSA, HBGary o Sony han caído victimas de grupos como Anonymous u otros atacantes mediante ataques muy sencillos y ampliamente conocidos. Estos ataques podrían haber sido evitados si las compañías contaran con los recursos apropiados, y para ello los que toman las decisiones tienen que tener la información necesaria.
If we have learned anything in 2011 is that nobody is safe from being attacked: companies such as RSA, HBGary or Sony have fallen victims of groups such as Anonymous or other attackers using very simple and widely known attacks. These attacks could have been avoided if companies had the appropriate resources and for that those who take decisions must have all the necessary information.
Es cierto que existen MBA enfocados a tecnología o específicos en seguridad que cubren esta área, pero no es suficiente. En mi opinión todas las escuelas de MBA deberían contener una sección con conceptos sobre seguridad y privacidad, ya que es fundamental que la alta dirección entienda y ejerza buenas prácticas de seguridad.
It is true that there are MBA focused on technology or even security specific covering this area but this is not enough. In my view all MBA schools should contain a section with security and privacy concepts, given that it is essential that senior management understand and exercise good security practices.
La información al igual que los empleados son posiblemente los dos activos más valiosos de cualquier empresa pero demasiadas veces no se saben identificar, valorar o cuantificar, y ambos activos quedan tocados si la seguridad de la empresa se ve comprometida con el robo de información: malestar entre los empleados y daño de la imagen corporativa, lo que deriva en daños económicos que ahora sí se podrán cuantificar y que podrían afectar a la PyG.
Similarly, Information and employees are possibly the two most valuable assets of any company that too often are not correctly identified, assessed or quantified, and both assets suffer if the company’s security is compromised with the theft of information: employees discomfort and damage to corporate image, resulting in economic damage that now can be quantified and could affect the P&L.
Las escuelas de negocios hacen un buen trabajo formando líderes, pero con este artículo hago un llamamiento a que incorporen conceptos de seguridad y privacidad en su oferta académica para tener organizaciones más preparadas, de arriba abajo.
Business schools do a good work forming leaders but with this article I appeal to incorporate security and privacy concepts in their academic offerings to have more prepared organizations, from top to bottom.
[Español] Hoy en día muchas naciones conscientes de las amenazas en Internet están creando ciber guerreros para poder combatir en este nuevo frente. Aunque la información es escasa algunas de estas naciones han hecho público parte de su plan de ciberguerra y han creado centros de entrenamientos y operaciones. También algunas empresas privadas y universidades ya empiezan a ofrecer este nuevo perfil del siglo XXI, aunque está claro que aún queda un largo camino por recorrer.
[English] Today many nations aware of threats on the Internet are creating Cyber Warriors in order to fight on this new front line. Although information is scarce some of these nations have made public part of their cyber warfare plans and are creating training and operations centers. Also some private companies and universities are beginning to offer this new role of the 21st century although clearly there is still a long way to go.
En este artículo estudiaremos algunas naciones que ofrecen la posibilidad de formarse y/o trabajar como ciber guerrero (Computer Network Operations, CNO), aunque debemos tener en cuenta que al ser un tema sensible generalmente requiere ser ciudadano de ese país para acceder a esta formación y/o trabajo.
In this article we will study some nations offering the possibility of education and/or working as a Cyber Warrior (Computer Network Operations, CNO), although we must bear in mind that due to the sensitive subject it is generally required being a citizen of that country to access this training and/or work.
EE.UU. / USA
Como no podía ser de otra manera EE.UU. dispone de diferentes opciones pero requieren ser ciudadano estadounidense.
As it could not be otherwise USA offers different options, but you need to be a U.S. citizen.
Sector público / Public Sector
Existen más opciones de las aquí presentadas pero hemos intentado resaltar las más significativas.
United States Military Academy at West Point: la prestigiosa academia militar de West Point ofrece un interesante programa de estudios como Seguridad de la Información, Ciberguerra y Forense con el fin de formar ciber guerreros.
United States Military Academy at West Point: the prestigious military academy of West Point offers an interesting program of studies such as Information Assurance, Cyber Warfare and Forensics in order to train cyber warriors.
TeleCommunications Systems (TCS): ha creado The Art of Exploitation University (AOE) con el fin de ofrecer formación en ciberguerra. Ofrece un amplio e interesante catálogo de cursos.
TeleCommunications Systems (TCS): it has created The Art of Exploitation University (AOE) in order to offer training in cyber warfare. It offers a broad and interesting catalogue of courses.
La OTAN desde su centro de NATO Cooperative Cyber Defence Centre of Excelence (CCDCOE) ofrece diversos cursos en CNO.
NATO from its NATO Cooperative Cyber Defense Centre of Excellence (CCDCOE) offers various courses in CNO.
Países como China, Israel, Francia, Rusia, Alemania, Brasil, India e Irán han anunciado públicamente la creación de unidades de ciberguerra y de centros de entrenamientos militares y/o académicos aunque no existe demasiada información pública al respecto.
Podemos apreciar que hoy en día existe una conciencia por crear estos perfiles en muchas naciones y que algunos países destacan en este campo como son los EE.UU., China o Israel. Sin duda los países que quieran sentirse “ciber seguros” tendrán que hacer grandes esfuerzos.
Si conoces más formación en ciberguerra / CNO o empresas en este campo, por favor envíame un correo con la información :)
¿Te gustaría ser un ciber guerrero o lo has sido? Cuéntanos tu experiencia!
Countries such as China, Israel, France, Russia, Germany, Brazil, India and Iran have publicly announced the creation of cyber warfare units and training facilities both in the army and/or universities although there is not much public information about it.
We can see that today there is an awareness to create these roles in many nations and some countries stand out in this field such as the United States, China or Israel. Certainly the countries which want to feel “cyber safe” will have to make great efforts.
If you know more training courses in Cyber Warfare / CNO or companies in this area, please send me an email with the information :)
Would you like to be a Cyber Warrior or you’ve been one? Tell us your experience!
[Español] Este mes la revista Red Seguridad incluye mi artículo sobre APT (Amenazas Persistentes Avanzadas) basado en mi experiencia personal en el trabajo donde hemos encontrado varias veces este tipo de amenazas.
[English] This month the magazine Red Seguridad includes my article about APT (Advanced persistent threats) based on my personal experience at work where we frequently discover this type of threat.
Sin duda los APT son un tema caliente y en el artículo detallo en qué consisten, casos reales de ataques, por qué se producen y son tan exitosos, así como algunas recomendaciones de cómo las empresas deberían protegerse.
No doubt APT are a hot topic and the article details what they are, cases studies of real attacks, why they occur and why they are so successful as well as some recommendations on how companies should protect themselves.
Por desgracia el artículo solo está en español pero si algún lector extranjero está interesado se lo puedo enviar para que lo traduzca con Bing :)
Unfortunately the article is only in Spanish but if a foreign reader is interested I can send a copy so he can translate it with Bing :)
No os perdáis otros artículos que escribo de forma frecuente en revistas de seguridad y mis servicios, que quizás sean de tu interés ;)
Como siempre un placer y ahora a seguir analizando la inseguridad…
Do not miss other articles that I usually write in security magazines and my services, which may be of interest to you ;)
My pleasure, as usual, and now on to keeping analyzing insecurity…
[Español] Para este artículo hablaremos de una magnífica herramienta como es Visual Studio 2010, el entorno de desarrollo de Microsoft, que utilizo a diario para realizar auditorías de código en C/C++ o .NET. Cuando imparto clases sobre SDL es frecuente encontrar programadores que no conocen las herramientas de seguridad que ofrece Visual Studio, incluso me sucede con expertos en seguridad que tampoco las conocen y esto debe cambiar.
[English] For this article we’ll talk about a magnificent tool such as Visual Studio 2010, Microsoft development environment, which I use on a daily basis to conduct code audits of C/C++ or.NET. When I teach the SDL courses it is common to find developers who do not know the security tools offered by Visual Studio, this even happens with security experts who do not know them either, and this must change.
Como ya he mencionado Visual Studio trae interesantes herramientas para escribir código seguro como programador o para buscar vulnerabilidades como auditor. Para ello estudiaremos dos herramientas que son identificación de funciones inseguras y análisis estático de código inseguro.
As I have already mentioned Visual Studio brings interesting tools to write secure code as a programmer or to look for vulnerabilities as auditor. To do this we will look at two tools that are unsafe functions identification and static analysis of insecure code.
Identificación de Funciones Inseguras / Unsafe Functions Identification
En la Fig. 1 podemos ver un código a modo de ejemplo que contiene dos funciones inseguras como son sprintf y strcpy. Nota: en este ejemplo ambas funciones no pueden ser controladas por un atacante pero lo que nos interesa es identificar estas funciones inseguras.
In Fig. 1 we can see a code example that contains two unsafe functions such as sprintf and strcpy. Note: in this example both functions cannot be controlled by an attacker, but what interests us is to identify these unsafe functions.
Fig. 1 – Ejemplo de funciones inseguras / Insecure function example
En la Fig. 2 Visual Studio, con la extensión de funciones insegura instalada, nos subraya la función sprintf en color violeta indicándonos algún problema. Al poner el cursor encima vemos que nos sale una ventana con el mensaje que esta función es insegura y prohibida según el SDL y nos ofrece alternativas seguras. Igualmente si nos ponemos encima de strcpy nos dará un mensaje parecido.
In Fig. 2 Visual Studio, with the insecure functions extension installed, point us at function sprintf in purple indicating a problem. When putting the cursor above we see that we get a window with the message that this function is unsafe and banned according to the SDL and offers safe alternatives. Also if we are on top of strcpy it will give us a similar message.
Fig. 2 – Función Insegura sprintf / Sprintf insecure function
Digamos que compilamos el código porque no hemos visto las funciones inseguras, entonces Visual Studio nos dará un aviso de error en la compilación de que existen funciones inseguras como se puede apreciar en la Fig. 3.
Let’s say that we compile the code because we have not seen the insecure functions, then Visual Studio will give us a warning notice in the compilation that there are unsafe functions as shown in Fig. 3.
Fig. 3 – Función insegura identificada al compilar el código / Unsafe function identified at compilation time
Sin duda esta extensión es de gran ayuda para identificar rápidamente las funciones inseguras que son más de 100 cuando estamos auditando código.
No doubt this extension is of great help to quickly identify unsafe functions as there are more than 100 when we are auditing code.
Análisis Estático de Código Inseguro / Static Analysis of Insecure Code
Visual Studio incorpora una potente herramienta de análisis estático para identificar código vulnerable en C/C++ que todo programador debería utilizar para validar su código. Algunas clases de errores que detecta la herramienta son:
Desbordamiento de buffer
Memoria sin inicializar
Referencia a puntero nulo
En la Fig. 4 tenemos un código modificado del ejemplo anterior conteniendo una clásica vulnerabilidad. En este fallo se copia una cadena de carácter A en un buffer, buf, de menor tamaño que provoca un desbordamiento de buffer (buffer overrun).
Visual Studio includes a powerful static analysis tool to identify vulnerabilities in code for C/ C++ that every programmer should use to validate its code. Some bug classes detected by the tool are:
Buffer overflow / Buffer overrrun
Un-initialized memory
Null pointer dereference
In Fig. 4 we have a modified code from previous example containing a classical vulnerability. In this bug a string, A, is being copied to a buffer, buf, of smaller size causing a buffer overflow.
Fig. 4 – Desbordamiento de buffer / Buffer overflow
Utilizamos la potente herramienta de análisis estático para buscar vulnerabilidades que ejecutamos desde la línea de comando con el parámetro /analyze. En la Fig.5 podemos ver cómo se nos informa de dos errores, C6202 y C6386, en referencia al desbordamiento de buffer.
We use the powerful static analysis tool to find vulnerabilities which we run from the command line with the parameter /analyze. In Fig. 5 we can see how it informs us of two warnings, C6202 and C6386, in reference to the buffer overflow.
Fig. 5 – Utilizando VS /analyze para identificar vulnerabilidades / Using VS /analyze to identify vulnerabilities
En la Fig. 6 podemos apreciar otra clase de vulnerabilidades que aparece con frecuencia cuando se libera memoria del mismo puntero en varias ocasiones. En este ejemplo si foo es verdadero se ejecuta un trozo de código y al final se libera el puntero. El problema es que al final de la función también se libera el mismo puntero. Tenemos dos mensajes de aviso C6001 y C6011 en referencia a uso de memoria sin inicializar y referencia a puntero nulo.
In Fig. 6 we can appreciate another class of vulnerabilities that often appears when memory is being freed on the same pointer on several occasions. In this example if foo is true it runs a piece of code and finally releases, free, the pointer. The problem is that the same pointer is also being released, free, at the end of the function. We have two warnings C6001 and C6011 messages in reference to un-initialized memory and null pointer dereference.
Fig. 6 – Referencia a puntero nulo / Null pointer dereference
El último ejemplo de código vulnerable (Fig. 7) es un fallo donde el programador se ha equivocado en la sentencia For ya que el rango de la variable buff comienza en 0 y termina en 14 y en el For se ha utilizado el mismo índice, 15 en este caso. Por tanto en este ejemplo se produce un desbordamiento de buffer ya que el índice esta fuera de rango.
The last example of vulnerable code, Fig. 7, is a bug where the programmer has mistaken the For loop as the variable buff range starts at 0 and ends at 14 and the For loop uses the same index declared in buff, 15 in this case. In this example there is a buffer overflow due to the declared index being out of range.
Fig. 7 – Índice fuera de rango / Index out of range
Sin duda Visual Studio es una poderosa herramienta para auditar código que debería formar parte de nuestro arsenal. Los ejemplos presentados no distan demasiado de ejemplos reales que he visto auditando código, por desgracia muchas veces la realidad supera a la ficción.
La herramienta de análisis estático es más efectiva si la combinamos con el Standard Annotation Language (SAL), que nos permite definir los parámetros de las funciones por lo que aportamos conocimiento a la herramienta y puede profundizar en sus análisis para identificar fallos, pero este uso avanzado lo dejaremos para otro artículo :)
¿Y tú que herramientas utilizas para análisis estático?
Undoubtedly Visual Studio is a powerful tool to audit code that should be part of our arsenal. The presented examples are not too far from real examples I’ve seen auditing code, unfortunately often fact is stranger than fiction.
The static analysis tool is most effective if we combine it with the Standard Annotation Language (SAL) that allows us to define the functions prototypes for which you provide knowledge to the tool so it can go deeper with the analysis to uncover bugs, but I leave this advanced usage for another article :)
Hoy en día existen diversas soluciones para ayudarnos a realizar auditorías wireless, lejos han quedado los días de utilizar aircrack en la línea de comandos. Ahora contamos con potentes herramientas que automatizan todo el proceso de romper redes wireless de forma sencilla y rápida. Para este artículo sólo estamos interesados en seis herramientas gratis, aunque soluciones comerciales como SILICA o The Portable Penetrator también pueden ser de interés para el lector.
Today there are various solutions to help us carry out wireless assessments, far were the days of using aircrack in the command line. We now have powerful tools that automate the entire process of breaking wireless networks quickly and easily. For this article we are only interested in six free tools but commercial tool such as SILICA or The Portable Penetrator solutions can also be of interest to the reader.
Wepbuster es una popular herramienta que ha quedado algo obsoleta aunque funciona perfectamente. Wepbuster identificará todos los Access Points (AP) cercanos y comenzará a ejecutar los distintos ataques incluidos en la suite de aircrack.
Es muy fácil de utilizar y no requiere interacción por parte del usuario. Las Fig. 1 y 2 muestran Wepbuster en acción.
Wepbuster is a popular tool which is a bit obsolete although it works perfectly. Wepbuster will identify every Access Point (AP) nearby and launch all attacks included in the aircrack suite.
It is very easy to use and requires no user interaction. The Fig. 1 and 2 show Wepbuster in action.
Esta herramienta escrita en java nos permite realizar distintos ataques en redes wireless. El usuario debe seleccionar el AP y el ataque a ejecutar. En la Fig. 3 vemos el GUI de grim wepa.
This tool written in java allows us to perform various attacks in wireless networks. The user must select the AP and the attack to run. In the Fig. 3 we see the grim wepa GUI.
Wiffy es una sofisticada herramienta automatizada para auditar redes wireless que nos ofrece interesantes opciones como realizar distintos ataques, denegación de servicios (DoS), crear rainbow tables o capturar información de una red mediante karmasploitation (karma + metasploit).
La Fig. 4 es la pantalla de inicio de wiffy y en la Fig. 5 wiffy ha identificado todos los AP cercanos y nos pide cuál atacar. Una vez seleccionado el objetivo AP, wiffy ejecutará todos los ataques de la suite aircrack de forma automática.
Wiffy is a sophisticated automated tool to audit wireless networks that offers interesting features such as performing various attacks, denial of service (DoS), create rainbow tables, or capture information on a network by using karmasploitation (karma + metasploit).
Fig. 4 is wiffy main window and in Fig. 5 wiffy has identified all nearby APs and asks us which attack to execute. After selecting the target AP, wiffy launches all attacks in the aircrack suite automatically.
Wifite es una versátil herramienta que a través de un simple GUI nos permite configurar la sesión de ataque (ver Fig. 6) y una vez configurados los parámetros se abre una ventana en modo texto. Es en esta ventana donde se realizan los ataques a todos los AP identificados (ver Fig. 7)
En cualquier momento podemos interactuar con la sesión pulsando Ctrl+C para cambiar el ataque o pasar a otro objetivo.
Wifite is a versatile tool that through a simple GUI allows us to configure the attack session, see Fig. 6, and once configured the settings a window in text mode is opened. It is in this window where attacks are executed against all identified AP. See Fig. 7.
At any time we can interact with the session by pressing CTRL+C to change the attack or move on to another target.
Fern WIFI Cracker es una potente herramienta escrita en python que nos permite realizar distintos ataques mediante un elegante GUI. En la Fig. 8 podemos ver la pantalla de inicio de la herramienta donde se ha realizado un escaneo y se han detectado varios AP.
Ahora ya podemos seleccionar un objetivo y el ataque que nos interese y Fern hará el resto de forma automatizada (ver Fig. 9).
Algunas ventajas de Fern son su extremada sencillez de uso, capacidad de ejecutar distintos ataques y que las contraseñas obtenidas son almacenadas en una base de datos. Desafortunadamente a veces el programa se cuelga.
Fern WIFI Cracker is a powerful tool written in python which allows you to perform various attacks through a sleek GUI. In Fig. 8 we can see the main window where a scan has been done and has detected several APs.
Now we can select the target AP and the attack that interests us and Fern will do the rest automatically (see Fig. 9).
Some advantages of Fern are its extreme ease of use, capable of executing various attacks and obtained passwords are stored in a database. Unfortunately sometimes the program hangs.
Gerix es la única herramienta de las analizadas incluida por defecto en Backtrack (4 y 5) y es posiblemente la más sofisticada y potente, ya que nos permite realizar distintos ataques o actuar como un AP malicioso de forma sencilla.
En la Fig. 10 vemos el panel de configuración de Gerix, donde podemos seleccionar el objetivo AP. El siguiente paso es ir probando los diferentes ataques, ver Fig. 11.
Gerix is the only tool of the analyzed included by default in Backtrack (4 and 5) and it is possibly the most sophisticated and powerful tool, allowing us to perform various attacks or act as a malicious AP in a simple way.
In the Fig. 10 we see Gerix configuration panel and where we can select the target AP. The next step is to try different attacks, see Fig. 11.
Fig. 10 – Gerix GUI
Fig. 11 – Gerix cracking
Conclusiones
A pesar de que existen más herramientas que nos permiten automatizar ataques wireless las aquí descritas posiblemente sean las mejores y nada tienen que envidiar a las soluciones comerciales. Lógicamente estas herramientas tienen mucho más potencial de lo descrito aquí, por eso recomiendo al lector que juegue con ellas. Además ninguna herramienta es la panacea por lo que el lector debería usar todas o varias por lo menos.
Al ser gratis y de código abierto estas herramientas son una sólida base para poder personalizar a nuestras necesidades y no es demasiado difícil añadirles nuevas funcionalidades, como por ejemplo una vez comprometida un AP realizar ataques a los sistemas utilizando metasploit de forma automatizada. ¿Algún lector quiere esponsorizar este proyecto? :)
¿Y tú que herramientas utilizas para auditar wireless?
Despite the fact that there are more tools that allow us to automate wireless attacks the described here may be the best and have nothing to envy to commercial solutions. Of course these tools have much more potential than what was described here, that is why I recommend the reader to play with them. Also no tool is a panacea and therefore the reader should use several or all of them at the very least.
These free and open source tools are a good starting point to customize for our needs and it is not too difficult to add new features like for example once an AP is compromised to execute attacks on systems using metasploit in an automated manner. Maybe a reader wants to sponsor this project? :)
[Español] Nuestras habilidades ofensivas no están completas sin algo de conocimiento sobre seguridad física y este libro rellena ese vacío. Practical Lock Picking: A Physical Penetration Tester’s Training Guide (ISBN-13: 978-1597496117) escrito por Deviant Ollam, todo un maestro en la materia, trata sobre el interesante mundo de las cerraduras y candados y cómo se abren.
[English] Our offensive skills are not completed without some knowledge about physical security and this book fills that gap. Practical Lock Picking: A Physical Penetration Tester’s Training Guide (ISBN-13: 978-1597496117) written by Deviant Ollam, a master on the field, is about the exciting world of locks and padlocks and how to open them.
La obra se divide en seis capítulos escritos de forma coloquial y está llena de ejemplos prácticos muy bien explicados que hacen la lectura de este libro muy amena y entretenida. El lector pasará de tener cero conocimientos en la materia a tener una buena base teórica, aunque sólo con la práctica se consigue la experiencia.
The work is divided into six chapters written in a colloquial manner and is full of very well explained examples that make the reading of this book very enjoyable and entertaining. The reader will go from having zero knowledge on the subject to have a good theoretical base, although you will get the experience only with practice.
El libro comienza con una introducción a diferentes tipos de cerraduras y sus debilidades para después profundizar en herramientas y técnicas para abrirlas desde nivel principiante hasta nivel avanzado. No os perdáis la sección: The secret weakness in 90% of padlocks :)
The book begins with an introduction to different types of locks and their weaknesses for later diving into tools and techniques to open them from a beginner level up to advanced level. Do not miss the section: The secret weakness in 90% of padlocks :)
He leído varios libros en la materia pero sin duda éste es el mejor por su sencillez y profundidad. Es de lectura obligatoria para cualquier cerrajero, experto en seguridad, pentester o simplemente como hobby.
I have read several books on the subject but undoubtedly this one is the best for its simplicity and depth. It is a required reading for any locksmith, security expert, pen tester or simply as a hobby.
Puntación (1 rosa, muy malo / 5 rosas, muy bueno): 5 Rosas (Lectura Obligatoria)
Score (1 rose, very bad / 5 roses, very good): 5 Roses (Mandatory Reading)
[Español] Este libro de la mítica serie Hacking Exposed está orientado al tema del malware y rootkits, en concreto su identificación y eliminación a lo largo de sus tres apartados, que se dividen en once capítulos y un estupendo apéndice. Hacking Exposed: Malware & Rootkits Secrets & Solutions (ISBN-13: 978-0071591188) está escrito por tres profesionales de la industria.
[English] This book of the mythical Hacking Exposed series is focused on the topic of malware and rootkits, in particular its identification and elimination along its three sections divided into eleven chapters and a great appendix. Hacking Exposed: Malware & Rootkits Secrets & Solutions (ISBN-13: 978 – 0071591188) is written by three professionals in the industry.
El primer apartado del libro está enfocado al estudio del Malware, en qué consiste y cómo se propaga. El segundo apartado, el mejor en mi opinión, estudia los rootkits tocando diferentes aspectos como usuario (user land), kernel o incluso rootkits que atacan sistemas virtualizados. La última sección trata sobre tecnologías de seguridad para identificar y prevenir malware y rootkits. Uno de los puntos fuertes del libro es el apéndice, donde se describe cómo crear tu propio sistema de identificación de rootkits apoyado con código fuente.
The first section of the book focuses on the study of Malware, what it is and how it spreads. The second, the best in my opinion, discusses about rootkits in the user space (user land), kernel or even rootkits that attack virtualized systems. The last section deals with security technologies to identify and prevent malware and rootkits. One of the strengths of the book is the Appendix, which describes how to create your own identification system for rootkits supported with source code.
Algunos capítulos son aburridos y nada técnicos (demasiado newbie) lo que resta calidad a la obra, pero como ya mencioné anteriormente el apartado de rootkits y el apéndice hacen que se olviden los puntos flojos y por ello le doy 4 rosas y no 3 en puntuación. Otra crítica negativa es no encontrar todo el código fuente en la web del libro como indican.
Some chapters are boring and not technical (too newbie) and therefore this work loses quality, but as already mentioned above the rootkits section and Appendix make us forget about the weak points and that is why I give 4 roses and no 3 in scoring. Another negative criticism is not to find all the source code on the book website as indicated.
Esta obra es de lectura recomendada para aquellos profesionales en seguridad que quieren conocer más en detalle el tema de malware y rootkits para defenderse. Se recomienda leer esta obra después del otro libro sobre rootkits ya mencionado en el blog.
This work is a recommended reading for security professionals who want to know more about malware and rootkits to defend against it. It is recommended to read this book after the other rootkits book already covered in the blog.
Puntación (1 rosa, muy malo / 5 rosas, muy bueno): 4 Rosas (Lectura Recomendada)
Score (1 rose, very bad / 5 roses, very good): 4 Roses (Recommended Reading)