[UNIX] GNU Screen Buffer Overflow (Negative Size)

From: SecuriTeam (support_at_securiteam.com)
Date: 11/30/03

  • Next message: SecuriTeam: "[NEWS] Multiple Remote Issues in Applied Watch IDS Suite"
    To: list@securiteam.com
    Date: 30 Nov 2003 14:06:03 +0200
    
    

    The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
    - - promotion

    The SecuriTeam alerts list - Free, Accurate, Independent.

    Get your security news from a reliable source.
    http://www.securiteam.com/mailinglist.html

    - - - - - - - - -

      GNU Screen Buffer Overflow (Negative Size)
    ------------------------------------------------------------------------

    SUMMARY

    A buffer overflow in GNU screen allows privilege escalation for local
    users. Usually screen is installed either setgid-utmp or setuid-root.

    It also has some potential for remote attacks or getting control of
    another user's screen. The problem is that you have to transfer around 2-3
    gigabytes of data to user's screen to exploit this vulnerability.

    DETAILS

    Vulnerable systems:
     * GNU Screen version 4.0.1, 3.9.15 and older versions

    Vulnerable code:
    ansi.c:

                case '0': case '1': case '2': case '3': case '4':
                case '5': case '6': case '7': case '8': case '9':
                  if (curr->w_NumArgs < MAXARGS)
                    {
                      if (curr->w_args[curr->w_NumArgs] < 100000000)
                        curr->w_args[curr->w_NumArgs] =
                          10 * curr->w_args[curr->w_NumArgs] + (c - '0');
                    }
                  break;
                case ';':
                case ':':
                  curr->w_NumArgs++;
                  break;

    w_NumArgs is signed integer, so after you've sent 2GB of ';' characters in
    escape sequence it wraps to negative and the < MAXARGS protection fails.
    Then it's only a matter of finding a position in memory where the next "if
    check" passes and does something useful.

    Vendor status:
    Sent a mail to screen@uni-erlangen.de (16.10), no reply. Sent a mail to
    screen mailing list (24.10), didn't help much.

    Unofficial patch:
    --- ansi.c.old 2003-11-15 18:04:12.000000000 +0200
    +++ ansi.c 2003-11-15 18:04:51.000000000 +0200
    @@ -559,7 +559,7 @@
                {
                case '0': case '1': case '2': case '3': case '4':
                case '5': case '6': case '7': case '8': case '9':
    - if (curr->w_NumArgs < MAXARGS)
    + if (curr->w_NumArgs >= 0 && curr->w_NumArgs < MAXARGS)
                    {
                      if (curr->w_args[curr->w_NumArgs] < 100000000)
                        curr->w_args[curr->w_NumArgs] =
    --- resize.c.old 2003-11-27 02:55:07.000000000 +0200
    +++ resize.c 2003-11-27 02:58:33.000000000 +0200
    @@ -682,6 +682,17 @@
       if (wi == 0)
         he = hi = 0;
     
    + if (wi > 1000)
    + {
    + Msg(0, "Window width too large, truncated");
    + wi = 1000;
    + }
    + if (he > 1000)
    + {
    + Msg(0, "Window height too large, truncated");
    + he = 1000;
    + }
    +
       if (p->w_width == wi && p->w_height == he && p->w_histheight == hi)
         {
           debug("ChangeWindowSize: No change.\n");

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:tss@iki.fi> Timo Sirainen.

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

    This bulletin is sent to members of the SecuriTeam mailing list.
    To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
    In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

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

    DISCLAIMER:
    The information in this bulletin is provided "AS IS" without warranty of any kind.
    In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.


  • Next message: SecuriTeam: "[NEWS] Multiple Remote Issues in Applied Watch IDS Suite"

    Relevant Pages

    • [UNIX] Trend Micro VirusWall Buffer Overflow in VSAPI Library
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... buffer overflow vulnerability in VSAPI library allows arbitrary code ... is called "vscan" which is set suid root by default. ... permissions and thus granted all local users the privilege to execute the ...
      (Securiteam)
    • [UNIX] SCO Multiple Local Buffer Overflow
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Local exploitation of a buffer overflow vulnerability in the ppp binary, ... allows attackers to gain root privileges. ...
      (Securiteam)
    • [NT] Microsoft Word 6.0/95 Document Converter Buffer Overflow (MS04-041)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... WordPad is "a word processing application that uses the MFC rich edit ... Remote exploitation of a buffer overflow vulnerability in Microsoft ... Microsoft Word format files into the Rich Text Format natively handled by ...
      (Securiteam)
    • [UNIX] Tikiwiki Command Injection and Arbitrary File Exposure Vulnerabilities
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Two security vulnerabilities have been recently discovered in Tikiwiki, ... Remote exploitation of an input validation vulnerability in Tikiwiki ... allows attackers to gain access to arbitrary files on the vulnerable ...
      (Securiteam)
    • [NT] Microsoft Windows GDI+ Gradient Fill Heap Overflow Vulnerability
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Microsoft Windows GDI+ Gradient Fill Heap Overflow Vulnerability ... consult their bulletin at the ...
      (Securiteam)