Playing with Sandbox: An analysis of Capsicum

Introduction

In this post we talk a little about sandbox. People that work and study software exploitation know the sandbox concept. This kind of feature when properly implemented on a system makes hard to exploit some kind of vulnerabilities, especially that involving memory corruption. In wikipedia we have a good reference about this:

“In computer security, a sandbox is a security mechanism for separating running programs. It is often used to execute untested code, or untrusted programs from unverified third parties, suppliers, untrusted users and untrusted websites. A sandbox typically provides a tightly controlled set of resources for guest programs to run in, such as scratch space on disk and memory. Network access, the ability to inspect the host system or read from input devices are usually disallowed or heavily restricted.”

The sandbox is a security mechanism that separates running processes. Basically we have a process with least privileges (target) and another process with greater privileges (broker). If the process with least privileges need execute some operation that is not allowed, a request is sent to the process with greater privileges that checks whether the operation has permissions to be executed and run with return to target (process with least privilege). Sandbox normally is used to protect the application and can also be used to provide a restricted environment for execute and test some malicious binaries, one example of this is Cuckoo Sandbox that used for malware analysis.

In this post we talk about Capsicum[1], is that a kind of sandbox developed by the University of Cambridge that support several common commands of the system such as tcpdump[2], hastd, dhclient, kdump and sshd as mentioned in the website[3]. The Capsicum is a new kind of sandbox but we have support for use in the FreeBSD and Linux[4]. The first experimental version was made only for FreeBSD[5] and available since version 9.0. This sandbox add two new features to the system, called capability mode and capabilities.

Here we introduced a rapid explanation about two modes. Capability mode is the feature that enable for the developers isolate processes allowing only that some system calls execute some tasks reducing the permissions of the process. Capabilities enables a more refined control over the files and devices. This post has more focus on the capability mode.

Continue reading “Playing with Sandbox: An analysis of Capsicum”

Uma análise do CVE-2012-0217

Introdução

Em junho desse ano (2012) o time de segurança do sistema operacional FreeBSD publicou um alerta de segurança sobre uma vulnerabilidade descoberta por Rafal Wojtczuk que afeta todas as versões 64 bits.

Essa  vulnerabilidade não só afeta o sistema  operacional FreeBSD  mas também vários sistemas operacionais e sistemas de virtualização[1] disponíveis, com exceção do OpenBSD 5.0 e o Linux que já tinham corrigido a vulnerabilidade desde 2006[3].

Nesse post será explicado a natureza da vulnerabilidade e como ela pode ser utilizada para obter execução de códigos no kernel. Apesar de já existir exploits públicos para Windows [4] e para FreeBSD[5] [6], um exploit para FreeBSD também será apresentado nesse artigo.

Assume-se que o leitor saiba  como funciona exploração  de vulnerabilidades  em kernel, sistemas operacionais e suas estruturas, principalmente IDT[7] e como realizar debugging do kernel.

Os experimentos  realizados  nesse  artigo  foram  realizados  utilizando  a  versão  9.0 RELEASE  do FreeBSD.

Continue reading “Uma análise do CVE-2012-0217”

Entendendo e explorando o CVE-2012-4576 para o kernel do FreeBSD

Introdução

Dando continuidade a exploração de vulnerabilidades em kernel-land [1], neste artigo serão analisados os detalhes da vulnerabilidade registrada no CVE-2012-4576 e como podemos utilizá-la para obter execução de código no kernel do FreeBSD.

Esta vulnerabilidade foi reportada por Mateusz Guzik e o advisory [2] oficial do time de segurança do FreeBSD foi publicado no dia 22 de Novembro de 2012.

A falha ocorre devido a falta de validação em uma chamada de sistema. Como resultado, regiões de memória podem ser sobrescritas. A vulnerabilidade existe no módulo que adiciona a compatibilidade de execução de arquivos binários nativos do Linux no FreeBSD, então apenas sistemas que usam este recurso podem estar vulneráveis.

Todos os experimentos neste artigo foram realizados no sistema operacional FreeBSD 7.0, 8.2 e 9.0 arquitetura 32 bits (i386).

Continue reading “Entendendo e explorando o CVE-2012-4576 para o kernel do FreeBSD”

The role of hypothesis and a (old) way to escalate privileges on FreeBSD – O papel da hipótese e um modo de escalar privilégios no FreeBSD

English / Português

English:

I do not remember when, but certain day I decided to look for vulnerabilities in the FreeBSD kernel. As it was a long time ago, I do not remember almost any detail of the process, I just remember I found one NULL pointer dereference without reading the source code or using fuzzing techniques. Nowadays that is not one of the most interesting vulnerabilities because is necessary some tweaks  to be vulnerable and to allow exploitation but my goal with this post is also to write a bit about the discovery process.

Português:

Não lembro exatamente quando, mas um certo dia, decidi começar a procurar vulnerabilidades no kernel do FreeBSD. Como faz muito tempo, não lembro de quase nenhum detalhe do processo, apenas lembro, que sem ler o código-fonte e sem  usar técnicas de fuzzing, acabei descobrindo um NULL pointer dereference. Nos dias atuais essa não é uma das vulnerabilidade mais interessantes porque precisa de alguns ajustes para estar vulnerável e permitir a exploração, mas meu objetivo nesse post é também escrever um pouco sobre o processo de descoberta.

Continue reading “The role of hypothesis and a (old) way to escalate privileges on FreeBSD – O papel da hipótese e um modo de escalar privilégios no FreeBSD”