Ubuntu logo

Developer

Atualizações de segurança de versão estável

Corrigindo uma falha de segurança no Ubuntu

Introdução

Fixing security bugs in Ubuntu is not really any different than fixing a regular bug in Ubuntu, and it is assumed that you are familiar with patching normal bugs. To demonstrate where things are different, we will be updating the dbus package in Ubuntu 10.04 LTS (Lucid Lynx) for a security update.

Obtendo o fonte

Neste exemplo, nós já sabemos que queremos corrigir o pacote dbus no Ubuntu 10.04 LTS (Lucid Lynx). Então primeiro você precisa determinar a versão do pacote que quer baixar. Podemos usar o comando “rmadison” para ajudar nesta tarefa:

$ rmadison dbus | grep lucid
dbus | 1.2.16-2ubuntu4 |         lucid | source, amd64, i386
dbus | 1.2.16-2ubuntu4.1 | lucid-security | source, amd64, i386
dbus | 1.2.16-2ubuntu4.2 | lucid-updates | source, amd64, i386

Typically you will want to choose the highest version for the release you want to patch that is not in -proposed or -backports. Since we are updating Lucid’s dbus, you’ll download 1.2.16-2ubuntu4.2 from lucid-updates:

$ bzr branch ubuntu:lucid-updates/dbus

Aplicando um patch no código fonte

Now that we have the source package, we need to patch it to fix the vulnerability. You may use whatever patch method that is appropriate for the package, including UDD techniques, but this example will use edit-patch (from the ubuntu-dev-tools package). edit-patch is the easiest way to patch packages and it is basically a wrapper around every other patch system you can imagine.

Para criar seu patch usando edit-patch:

$ cd dbus
$ edit-patch 99-fix-a-vulnerability

Isto irá aplicar os patches existentes e colocar o pacote em um diretório temporário. Agora edite os arquivos necessários para corrigir a vulnerabilidade. Frequentemente, o upstream terá fornecido um patch, então você pode aplicá-lo:

$ patch -p1 < /home/user/dbus-vulnerability.diff

Depois de fazer as mudanças necessárias, é só pressionar Ctrl-D ou digitar “exit” para sair temporariamente do shell.

Formatando o registro de alteração e os patches

Depois de aplicar seus patches você deverá atualizar o registro de alterações. O comando “dch” é utilizado para editar arquivos “debian/changelog” e “edit-patch” irá iniciar o “dch” automaticamente depois de desfazer a aplicação dos patches. Se você não está usando o “edit-patch”, você pode iniciar o “dch -i” manualmente. Diferentemente dos patches normais, você deve usar o seguinte formato (note a que o nome da distribuição utiliza lucid-security já que é uma atualização de segurança para o Lucid) para atualizações de segurança:

dbus (1.2.16-2ubuntu4.3) lucid-security; urgency=low

  * SECURITY UPDATE: [DESCRIBE VULNERABILITY HERE]
    - debian/patches/99-fix-a-vulnerability.patch: [DESCRIBE CHANGES HERE]
    - [CVE IDENTIFIER]
    - [LINK TO UPSTREAM BUG OR SECURITY NOTICE]
    - LP: #[BUG NUMBER]
...

Atualize o seu patch para que use tags apropriadas. Seu patch deve ter no mínimo a orígem, descrição e tags bug-Ubuntu. Por exemplo, edite debian/patches/99-fix-a-vulnerability.patch para ter algo como:

## Description: [DESCRIBE VULNERABILITY HERE]
## Origin/Author: [COMMIT ID, URL OR EMAIL ADDRESS OF AUTHOR]
## Bug: [UPSTREAM BUG URL]
## Bug-Ubuntu: https://launchpad.net/bugs/[BUG NUMBER]
Index: dbus-1.2.16/dbus/dbus-marshal-validate.c
...

Várias vulnerabilidades podem ser corrigidas no mesmo envio de segurança; apenas certifique-se de usar patches diferentes para vulnerabilidades diferentes.

Testar e enviar o seu trabalho

Neste ponto, o processo é o mesmo que para corrigir um erro comum no Ubuntu. Especificamente, você deve:

  1. Construir seu pacote e verificar se compilou sem erros e sem quaisquer avisos de compilador
  2. Atualizar para a nova versão do pacote de uma versão anterior
  3. Verifique se o novo pacotes corrige a vulnerabilidade e não introduz nenhuma regressão
  4. Envie seu trabalho via proposta de mesclagem do Launchpad, registre um erro no Launchpad assegurando-se de marcar o erro como erro de segurança e inscreva-se no “ubuntu-security-sponsors”.

Se a vulnerabilidade de segurança não é pública ainda então não adicione a proposta de mesclagem e certifique-se de que você marcou a falha como privada.

The filed bug should include a Test Case, i.e. a comment which clearly shows how to recreate the bug by running the old version then how to ensure the bug no longer exists in the new version.

The bug report should also confirm that the issue is fixed in Ubuntu versions newer than the one with the proposed fix (in the above example newer than Lucid). If the issue is not fixed in newer Ubuntu versions you should prepare updates for those versions too.

Atualizações de versão estável

We also allow updates to releases where a package has a high impact bug such as a severe regression from a previous release or a bug which could cause data loss. Due to the potential for such updates to themselves introduce bugs we only allow this where the change can be easily understood and verified.

O processo para atualizações de versões estáveis é o mesmo que o processo para falhas de seguranção, exceto que você deve registrar “ubuntu-sru” no relatório de erro.

The update will go into the proposed archive (for example lucid-proposed) where it will need to be checked that it fixes the problem and does not introduce new problems. After a week without reported problems it can be moved to updates.

Consulte a Página wiki de atualizações de versão estável para mais informações.