arpwatch terminated with buffer overflow

Bug #1097289 reported by Steve Kersley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
arpwatch (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

A server that had been running arpwatch on Ubuntu LTS 10.04 was upgraded to LTS 12.04.1. Following this arpwatch is terminated after running for a few seconds with:

 *** buffer overflow detected ***: /usr/sbin/arpwatch terminated

Prior to being terminated, it appears to run as usual, with new stations being detected and logged to syslog.

As well as purging and re-installing, I have also tried installing arpwatch to another server running 12.04.1 with i386 architecture, and to a freshly installed (not updated from a previous release) 12.10 desktop and all exhibit the same behaviour whereby arpwatch terminates after a few seconds operation.

Normally I run arpwatch with an added -Q flag to suppress email notifications, but have reverted to the default flags (-N -p) but this does not address the issue.

# lsb_release -rd
Description: Ubuntu 12.04.1 LTS
Release: 12.04

# apt-cache policy arpwatch
arpwatch:
  Installed: 2.1a15-1.1+squeeze1build0.12.04.1
  Candidate: 2.1a15-1.1+squeeze1build0.12.04.1
  Version table:
 *** 2.1a15-1.1+squeeze1build0.12.04.1 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/universe amd64 Packages
        100 /var/lib/dpkg/status
     2.1a15-1.1 0
        500 http://archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages

What should happen: arpwatch should run until stopped
What does happen: arpwatch is terminated

Related branches

Revision history for this message
Steve Kersley (steve-kersley) wrote :

Watching ARP traffic with tcpdump while running arpwatch has narrowed this down to an overflow within name resolution functions.

On every instance that arpwatch terminated, I found that the next ARP packet involved a particular host that had an excessively long hostname in the DNS - 37 characters, or 55 as a fully qualified hostname, which I'm assuming is overflowing some buffer.

While this problem is therefore unlikely to affect many others, there clearly is code that is writing data into a buffer that is of insufficent size:

In db.c, in function elist_alloc() (line 297 in current revision) strcpy is being used to write the hostname into a fixed length char[34] (defined in struct einfo{}, line 65 same file) with no checking of size. This looks to be a simple fix, but currently don't have time to learn the debian/ubuntu development methodologies to submit a patch, so have renamed my excessive hostname and hopefully the maintainer can at some point change the strcpy to a strncpy. (I note that a couple of lines below, the storing of the interface name is done with strncpy...)

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package arpwatch - 2.1a15-1.3

---------------
arpwatch (2.1a15-1.3) unstable; urgency=medium

  * Non-maintainer upload
  * Fix buffer overflow with hostnames longer than 33 characters (patch from
    Christoph Biedl). Closes: #705894, LP: #1097289

 -- Florian Schlichting <email address hidden> Sat, 25 Oct 2014 23:12:41 +0200

Changed in arpwatch (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.