Chris Morris 20420be1a6 Fixed logic to strip out user params.
Disclaimer: changes like these in this sort of app are tricky because
it's harder to presume the intention of the code in question.

The prior line:

```
user.update_attributes(params[:user].reject { |k| k == ("password" || "password_confirmation") || "user_id" })
```

returns an empty hash, because of the way the block evaluates:

```
irb(main):002:0> k = 'foo'
=> "foo"
irb(main):003:0> k == ("password" || "password_confirmation") || "user_id"
=> "user_id"
```

Before the last change to that line, without 'user_id' outside the
params, it didn't evaluate properly either:

```
irb(main):007:0> k = 'password_confirmation'
=> "password_confirmation"
irb(main):008:0> k == ("password" || "password_confirmation")
=> false
irb(main):009:0> ("password" || "password_confirmation")
=> "password"
```

So, in the normal use case for this form, you can't update any other
attribute of the User. To me, that's probably the best argument for
making this change, but it does simplify the SQL Injection attack
(although perhaps the prior complication was intended).

Before this change, injecting conditional SQL into the user_id param in
the account_settings update call would allow the password of whatever
account is found (e.g. the first one if injecting 'OR 1=1') to be reset,
but without additional attacks, the email address of that account is not
known.

After this change, the email address of that account now is also updated
in addition to the password, making it simpler to get in as an admin --
though you're still presuming the first account to be an admin.
2013-09-25 16:56:34 -05:00
2013-09-25 16:56:34 -05:00
2013-08-08 16:21:04 -04:00
2013-03-19 17:27:18 -04:00
2013-09-05 16:52:17 -04:00
2013-09-10 10:02:11 -04:00
2013-09-25 16:56:34 -05:00
2013-09-06 15:44:40 -04:00
2013-07-27 12:31:51 +10:00
2013-09-06 16:03:09 -04:00

Getting Started

With Ruby, Rubygems, Git, and Bundler installed

git clone https://github.com/OWASP/railsgoat.git

cd railsgoat

rvm use 1.9.3@railsgoat --create

bundle

rake db:create

rake db:migrate

rails s

open http://0.0.0.0:3000

Start hacking!!!

Developer Note

Conversion to the OWASP Top 10, 2013 is under way.

You can view progress within the top-10-2013 branch.

git fetch origin
git checkout top-10-2013

Then proceed with browsing the site as normal 👍


Build Info

Code Climate

License Stuff

The MIT License (MIT)

Copyright (c) 2013 The Open Web Application Security Project

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


S
Description
No description provided
Readme 10 MiB
Languages
HTML 54.1%
JavaScript 21%
Ruby 15.6%
SCSS 6.1%
CSS 3.1%