Subject: Bug#4075: Possible security problem with lrzsz

From: Ian Jackson <[email-masked]>
Date: Thu, 8 Aug 96 15:35 BST

Package: lrzsz
Version: 0.12a-5

I've not heard from the author wrt my query below.  I'm filing this
bug to make sure that this issue gets checked rather than forgotten.
Thank you for your attention.

Ian.

Mike Neuffer writes ("Re: lrzsz ? Re: forwarded message from CERT Bulletin"):
...
> I'm not the author, but lrzsz is almost identical to the "normal" rzsz 
> implemetation the only difference is that it gives more status information.
> The diff itself is rather small.

------- start of forwarded message (RFC 934 encapsulation) -------
In-Reply-To: <[email-masked]>
References: <[email-masked]>
To: Debian private list <[email-masked]>
Subject: lrzsz ? Re: forwarded message from CERT Bulletin

CERT write:
> Topic:          "Trojan Horse" vulnerability via rz program
...
>      All existing versions of the rz program (a program for receiving
>      files over serial lines using the Z-Modem protocol) are equipped
>      with a feature that allows the sender of a file to request the
>      execution of arbitrary commands on the receiver's side.  The user
>      using rz does not have any control over this feature.
> 
>      The workaround is to have rz never execute any command, and
>      always pretend a successful execution.

The version we distribute is called `lrzsz', and I suspect it is a
different version.

Nevertheless I'd appreciate it if the author could confirm that the
command execution feature is disabled.

Ian.
------- end -------
------- start of forwarded message (RFC 934 encapsulation) -------
Article: 124 of comp.security.announce
Path: lyra.csx.cam.ac.uk!warwick!usenet.eel.ufl.edu!spool.mu.edu!news.sgi.com!enews.sgi.com!lll-winken.llnl.gov!uwm.edu!math.ohio-state.edu!news.cis.ohio-state.edu!nntp.sei.cmu.edu!news.sei.cmu.edu!cert-advisory
Newsgroups: comp.security.announce
Organization: CERT(sm) Coordination Center -  +1 412-268-7090
Lines: 206
Approved: [email-masked]
Distribution: world
Message-ID: <[email-masked]>
Reply-To: [email-masked]
NNTP-Posting-Host: why.cert.org
Keywords: security CERT
Originator: [email-masked]
Originator: [email-masked]
From: CERT Bulletin <[email-masked]>
Subject: CERT Vendor-Initiated Bulletin VB-96.12 - FreeBSD
Date: 30 Jul 1996 19:22:18 GMT

- -----BEGIN PGP SIGNED MESSAGE-----

=============================================================================
CERT(sm) Vendor-Initiated Bulletin VB-96.12
July 30, 1996

Topic: "Trojan Horse" vulnerability via rz program
Source: FreeBSD, Inc.

To aid in the wide distribution of essential security information, the CERT
Coordination Center is forwarding the following information from FreeBSD, Inc.
FreeBSD, Inc. urges you to act on this information as soon as possible.
FreeBSD, Inc. contact information is included in the forwarded text below;
please contact them if you have any questions or need further information.

=======================FORWARDED TEXT STARTS HERE============================

=============================================================================
FreeBSD-SA-96:17                                            Security Advisory
Revised: Tue Jul 16 21:44:54 PDT 1996                           FreeBSD, Inc.

Topic:          "Trojan Horse" vulnerability via rz program

Category:       ports
Module:         rzsz
Announced:      1996-07-16
Affects:        All FreeBSD ports collections released before 2.1.5-RELEASE
Corrected:      ports collection as of 1996-07-06
Source:         rzsz shareware package
FreeBSD only:   no

Patches:        ftp://freebsd.org/pub/CERT/patches/SA-96:17/

=============================================================================

I.   Background

     All existing versions of the rz program (a program for receiving
     files over serial lines using the Z-Modem protocol) are equipped
     with a feature that allows the sender of a file to request the
     execution of arbitrary commands on the receiver's side.  The user
     using rz does not have any control over this feature.

     The workaround is to have rz never execute any command, and
     always pretend a successful execution.

     All FreeBSD users are encouraged to use the workaround provided.
     Since the intent of the Z-Modem protocol is to provide a reliable
     connection between systems of a vastly different architecture,
     the execution of local commands at request of the sending side
     cannot even be considered a useful feature at all.

II.  Problem Description

     The Z-Modem protocol specifies a mechanism which allows the
     transmitter of a file to execute an arbitrary command string
     as part of the file transfer.  This is typically used to rename
     files or eliminate temporary files.  A malicious "trusted" sender
     could send down a command that could damage a user's environment.

III. Impact

     The rzsz package is an optional port that made be installed on
     some FreeBSD systems.  This program is not installed by default.
     Systems without this program are not vulnerable.

     rz allows "Trojan Horse" type attacks against unsuspecting users.
     Since the rz executable does not run with special privileges,
     the vulnerability is limited to changes in the operating environment
     that the user could willingly perform.

     This vulnerability is a fundamental flaw in the Z-Modem protocol.
     Other operating systems and other implementations of the Z-Modem
     protocol may also suffer similar vulnerabilities.

IV.  Workaround

     Disable the rz program.  If it has been installed, it would
     typically be found in /usr/local/bin.

        # chmod 000 /usr/local/bin/rz
        # ls -l /usr/local/bin/rz
        ----------  1 root  wheel  23203 Mar  4 23:12 /usr/local/bin/rz

V. Solution(s)

     This feature is a relatively unknown part of the Z-Modem protocol.
     It is not critical to file transfers in general.  The safest
     approach is to disable this feature in the receiving program.

     Any rzsz port that is obtained from the official ports collection
     after 1996-07-06 includes the following patch to disable this feature.
     This patch applies to rzsz v3.42, if you have an earlier version
     of the rzsz sources, please upgrade to the latest version first.

    *** rz.c.orig       Sat Jul  6 17:34:26 1996
    --- rz.c    Sat Jul  6 17:44:52 1996
    ***************
    *** 1020,1039 ****
    --- 1020,1045 ----
                    case ZCOMMAND:
                            cmdzack1flg = Rxhdr[ZF0];
                            if (zrdata(secbuf, 1024) == GOTCRCW) {
    + #ifdef BIG_SECURITY_HOLE
                                    void exec2();

                                    if (cmdzack1flg & ZCACK1)
                                            stohdr(0L);
                                    else
                                            stohdr((long)sys2(secbuf));
    + #else
    +                           stohdr(0L);
    + #endif
                                    purgeline();        /* dump impatient questions */
                                    do {
                                            zshhdr(4,ZCOMPL, Txhdr);
                                    }
                                    while (++errors<20 && zgethdr(Rxhdr) != ZFIN);
                                    ackbibi();
    + #ifdef BIG_SECURITY_HOLE
                                    if (cmdzack1flg & ZCACK1)
                                            exec2(secbuf);
    + #endif
                                    return ZCOMPL;
                            }
                            zshhdr(4,ZNAK, Txhdr); goto again;

=============================================================================
FreeBSD, Inc.

Web Site:                       http://www.freebsd.org/
Confidential contacts:          [email-masked]
PGP Key:                        ftp://freebsd.org/pub/CERT/public_key.asc
Security notifications:         [email-masked]
Security public discussion:     [email-masked]

Notice: Any patches in this document may not apply cleanly due to
        modifications caused by digital signature or mailer software.
        Please reference the URL listed at the top of this document
        for original copies of all patches if necessary.
=============================================================================

========================FORWARDED TEXT ENDS HERE=============================

If you believe that your system has been compromised, contact the CERT
Coordination Center or your representative in the Forum of Incident Response
and Security Teams (FIRST).

We strongly urge you to encrypt any sensitive information you send by email.
The CERT Coordination Center can support a shared DES key and PGP. Contact
the CERT staff for more information.

Location of CERT PGP key
         ftp://info.cert.org/pub/CERT_PGP.key

CERT Contact Information
- - ------------------------
Email    [email-masked]

Phone    +1 412-268-7090 (24-hour hotline)
                CERT personnel answer 8:30-5:00 p.m. EST
                (GMT-5)/EDT(GMT-4), and are on call for
                emergencies during other hours.

Fax      +1 412-268-6989

Postal address
        CERT Coordination Center
        Software Engineering Institute
        Carnegie Mellon University
        Pittsburgh PA 15213-3890
        USA

CERT publications, information about FIRST representatives, and other
security-related information are available from[-1z
        http://www.cert.org/
        ftp://info.cert.org/pub/

CERT advisories and bulletins are also posted on the USENET newsgroup
        comp.security.announce

To be added to our mailing list for CERT advisories and bulletins, send your
email address to
        [email-masked]

CERT is a service mark of Carnegie Mellon University.

This file: ftp://info.cert.org/pub/cert_bulletins/VB-96.12.freebsd

- -----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMf4jb3VP+x0t4w7BAQH8OwP+LUNb+2PueYArBM8OEqXz1s/8O64pPngY
ar8A6e9aCL/GjOltw+cuVPlqqefEPqsOVa2UZZTezZlv1+AkXgdUhr47L7Tc9kEH
KARlnuiFAMvWPN3rMZqcU7zT7x5jgMsHxM4bIA48SARKStACBdVnFWpLg7h6+utm
U1o1DPizbS0=
=DcYg
- -----END PGP SIGNATURE-----

------- end -------