🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #83953

Re: STARTTLS / SASL and plaintext command injection

#83953
From: Julien ÉLIE
Date: Sun, 03 Apr 2011 15:24
134 lines
5091 bytes
Hi all,

> An interesting report (CVE-2011-0411): 
> http://www.postfix.org/CVE-2011-0411.html
> 
> I have not tested with INN but at first thought, I do not see why it
> would not be impacted (nnrpd/line.c goes on reading the input of
> commands). I write in this public newsgroup because CVE-2011-0411 is
> public.

Confirmed when I send "STARTTLS\r\nDATE\r\n" with openssl:


17:04 news@trigo ~/work/openssl/openssl-1.0.0d% apps/openssl s_client -quiet -starttls smtp -connect news.trigofacile.com:119
didn't found starttls in server response, try anyway...
depth=0 C = FR, ST = news.trigofacile.com, O = news.trigofacile.com, CN = news.trigofacile.com
verify error:num=18:self signed certificate
verify return:1
depth=0 C = FR, ST = news.trigofacile.com, O = news.trigofacile.com, CN = news.trigofacile.com
verify return:1
500 What?
111 20110403150413
QUIT
205 Bye!


The 500 artefact is because of the EHLO sent by openssl before STARTTLS.
You see here that the DATE command is answered.





For those who want to fix it (before waiting for the next 2.5.3 release),
here is a patch.
The issue has been present since INN 2.3.0 (when STARTTLS was implemented).



Index: nnrpd.h
===================================================================
--- nnrpd.h	(révision 9183)
+++ nnrpd.h	(copie de travail)
@@ -291,6 +291,7 @@
 
 void line_free(struct line *);
 void line_init(struct line *);
+void line_reset(struct line *);
 READTYPE line_read(struct line *, int, const char **, size_t *, size_t *);
 
 #ifdef HAVE_SASL
Index: line.c
===================================================================
--- line.c	(révision 9183)
+++ line.c	(copie de travail)
@@ -67,6 +67,17 @@
 }
 
 /*
+**  Reset a line structure.
+*/
+void
+line_reset(struct line *line)
+{
+    assert(line);
+    line->where = line->start;
+    line->remaining = 0;
+}
+
+/*
 **  Timeout is used only if HAVE_SSL is defined.
 */
 static ssize_t
Index: sasl.c
===================================================================
--- sasl.c	(révision 9183)
+++ sasl.c	(copie de travail)
@@ -326,6 +326,9 @@
                 GRPcount = 0;
                 PERMgroupmadeinvalid = false;
             }
+
+            /* Reset our read buffer so as to prevent plaintext command injection. */
+            line_reset(&NNTPline);
         }
     } else {
 	/* Failure. */
Index: misc.c
===================================================================
--- misc.c	(révision 9183)
+++ misc.c	(copie de travail)
@@ -518,5 +518,8 @@
         GRPcount = 0;
         PERMgroupmadeinvalid = false;
     }
+
+    /* Reset our read buffer so as to prevent plaintext command injection. */
+    line_reset(&NNTPline);
 }
 #endif /* HAVE_SSL */





With this patch, here is a new attempt with openssl:



17:06 news@trigo ~/work/openssl/openssl-1.0.0d% apps/openssl s_client -quiet -starttls smtp -connect news.trigofacile.com:119
didn't found starttls in server response, try anyway...
depth=0 C = FR, ST = news.trigofacile.com, O = news.trigofacile.com, CN = news.trigofacile.com
verify error:num=18:self signed certificate
verify return:1
depth=0 C = FR, ST = news.trigofacile.com, O = news.trigofacile.com, CN = news.trigofacile.com
verify return:1
500 What?
DATE
111 20110403150638
QUIT
205 Bye!


The answer to DATE is not given after "500 What?".  I had to explicitly
ask for it.
The issue is therefore solved.

It would be worthwhile mentioning it in RFC 4642 and RFC 4643.

-- 
Julien ÉLIE

« Petite annonce : Femme perdue cherche cartographe pour planifier
  leur futur. »
Technical Details
Message-ID: <ina3eh$73o$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!news.matabio.net!jeffrey.matabio.net!news.trigofacile.com!.POSTED.aaubervilliers-552-1-84-69.w90-3.abo.wanadoo.fr!not-for-mail
References: <8ua932Fhr1U1@mid.individual.net>

Show Full Headers
Complete Article Headers
Message-ID: <ina3eh$73o$1@news.trigofacile.com>
Subject: Re: STARTTLS / SASL and plaintext command injection
Date: Sun, 03 Apr 2011 17:24:01 +0200
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <8ua932Fhr1U1@mid.individual.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!news.matabio.net!jeffrey.matabio.net!news.trigofacile.com!.POSTED.aaubervilliers-552-1-84-69.w90-3.abo.wanadoo.fr!not-for-mail
Newsgroups: news.software.nntp
Organization: TrigoFACILE -- http://www.trigofacile.com/
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 3 Apr 2011 15:24:01 +0000 (UTC)
Injection-Info: news.trigofacile.com;
 posting-host="aaubervilliers-552-1-84-69.w90-3.abo.wanadoo.fr:90.3.91.69";
 logging-data="7288"; mail-complaints-to="abuse@trigofacile.com"
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.2.15)
 Gecko/20110303 Thunderbird/3.1.9
In-Reply-To: <8ua932Fhr1U1@mid.individual.net>
Lines: 133
X-Original-Bytes: 4863