Commit Graph

204 Commits

Author SHA1 Message Date
Mike McCabe cc7535af30 adding env variable to run vulnerability tests 2013-10-07 15:23:37 -04:00
Mike McCabe 19ee423d8d pinning dbcleaner to lower version due to https://github.com/bmabey/database_cleaner/issues/224 2013-10-07 15:23:37 -04:00
Ken Johnson b3c309e776 Merge pull request #51 from chrismo/readme_for_capybara
Additions to README
2013-10-07 09:34:00 -07:00
chrismo e71834b830 Additions to README 2013-10-07 10:21:33 -05:00
Ken Johnson 83a16baf44 Merge pull request #49 from chrismo/capybara
Added notice and removed spoilers from spec names.
2013-10-03 17:54:55 -07:00
chrismo 525dfa1717 Added notice and removed spoilers from spec names. 2013-10-03 11:00:43 -05:00
Ken Johnson 538d01e5cf Merge pull request #48 from chrismo/capybara
MOAR CAPYBARA
2013-10-02 16:31:54 -07:00
chrismo 4ccdca8984 Fixed model specs, some of which I broke.
There's a fight here between DatabaseCleaner strategies - simpler to use
the default :transaction for model specs, but Capybara lives in a
different world where different connections are in play and
:transactions don't work. So, while introducing the more cumbersome
(though with more control) DatabaseCleaner gem and its truncation
strategy, I forgot to make sure the model specs had the fixtures present
that they depend on. This is fixed up now.

The user spec for invalid email was also failing - the regex there is
not savvy enough to handle rejecting two @ signs, so I made the invalid
value something still invalid to get it passing -- real regex validation
of email is ... impossible, so we'll roll with this and move on.
2013-10-02 17:53:12 -05:00
chrismo 911a52ee83 Add pending code to flip-flop results of specs.
This isn't the cleanest approach, but should be good for now.

Obviously, there are two contexts for these specs: one is from the
maintainer's standpoint, the other is from the trainee who is using
RailsGoat for training.

The maintainer wants all of these specs to pass, to ensure the
vulnerabilities are still functional as vulnerabilities.

The trainee could potentially use these specs (though reading the specs
contains spoilers) to track and verify their fixes.

I've wired in a pending block around each assertion that checks a method
to see what the result of the pending call would be. You can see
examples of how this works with conditions here:
https://www.relishapp.com/rspec/rspec-core/v/2-14/docs/pending/pending-examples

This means these specs will all fail now by default (the trainee
context), but will pass, when vulnerable, if the RAILSGOAT_MAINTAINER
env var is set.

The only flaw at the moment is that in the trainee context, fixing the
vulnerabilities will result in the specs going from failing to
_pending_, not passing (which makes sense, given how we're using RSpec's
pending functionality).

Maybe it'd be simpler/better to have a boolean toggle of our own somehow
wrap the assertions in blocks to do explicitly what we want (flip-flop
the result based on the context).
2013-10-01 23:26:28 -05:00
chrismo b1a3882496 Mass assignment spec added 2013-10-01 17:14:21 -05:00
chrismo 85b0c7608b Info disclosure spec added 2013-10-01 16:47:06 -05:00
chrismo 0021ddd036 Unvalidated redirect spec added 2013-10-01 16:20:15 -05:00
chrismo 4f1526e021 URL access spec added 2013-10-01 16:06:21 -05:00
chrismo 0df6735b53 Added example of CSRF vulnerability in csrf_spec. 2013-09-30 15:29:36 -05:00
cktricky da061c79b6 intended to remove some of the weirdness when updating a users account. A blank password basically ends up causing the previously existing password to be hashed twice. Probably move to has_secure_password at some point although that may end up screwing up the intent of the particular tutorial item 2013-09-30 13:03:03 -04:00
Ken Johnson 289716b24c Merge pull request #47 from chrismo/capybara
Capybara added to demonstrate vulnerabilities.
2013-09-27 18:53:51 -07:00
chrismo 8e238e1d81 Insecure Direct Object Reference spec added.
This includes two scenarios - the work_info one mentioned in the
tutorials, but also one allowing downloading of source code, which may
belong somewhere else as I haven't worked through all the tutorials yet.
2013-09-27 18:05:45 -05:00
chrismo 1c8b6e9e17 Broken Authorization specs added. 2013-09-27 17:30:57 -05:00
chrismo 269d5a0075 XSS Capybara spec added. 2013-09-27 16:58:33 -05:00
chrismo e0bca0139e Added command injection Capybara spec. 2013-09-27 14:59:30 -05:00
chrismo df9efa915b Capybara added to demonstrate vulnerabilities.
Adding Capybara to verify replay-ability of hacking vulnerabilities. I
imagine these may want to be kept on a different branch for QA and
educational purposes, but not distributed with master when forked.

This commit also includes demonstrating the SQL Injection vulnerability.
2013-09-27 10:35:59 -05:00
Ken Johnson 1860d24ac8 Merge pull request #46 from chrismo/fix_upload
Add .gitkeep on data folder so uploads work
2013-09-27 07:35:23 -07:00
Ken Johnson fec458f1a7 Merge pull request #45 from chrismo/users_controller_change
Fixed logic to strip out user params.
2013-09-27 07:34:24 -07:00
chrismo 8793ca8a88 Add .gitkeep on data folder so uploads work 2013-09-26 10:31:11 -05:00
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
cktricky 90c4807554 merge 2013-09-24 21:13:59 -04:00
cktricky aab489ef40 fix for performance bug 2013-09-10 21:58:29 -04:00
Ken Johnson 2eeb8291ba Merge pull request #40 from mccabe615/master
Minor Changes
2013-09-10 10:19:48 -07:00
Michael McCabe 9638d8137b travis fix 2013-09-10 10:02:11 -04:00
Michael McCabe 2949ff6a0d Merge branch 'master' of github.com:mccabe615/railsgoat into ubuntu-fix 2013-09-10 09:18:08 -04:00
Michael McCabe 987b6d8844 setting up travis ci env 2013-09-10 09:17:40 -04:00
Michael McCabe 292e8d9845 adding execjs and therubyracer to fix js issue on ubuntu 2013-09-09 21:45:00 -04:00
mccabe615 5123d8ba77 Update README.md 2013-09-06 16:03:09 -04:00
Michael McCabe 16d1150375 adding basic tests or user model, more to come 2013-09-06 15:55:08 -04:00
Michael McCabe 69c180e845 minor changes to spec_helper and user model 2013-09-06 15:54:06 -04:00
Michael McCabe dc3de592ea init\'ing guard-rspec 2013-09-06 15:44:40 -04:00
Michael McCabe 914e35e0dd adding rspec-rails and guard-rspec 2013-09-06 15:43:59 -04:00
Michael McCabe 71c690bd03 Merge branch 'master' of github.com:mccabe615/railsgoat 2013-09-06 10:09:04 -04:00
Michael McCabe 0bb5fd06c1 fixing Gemfile 2013-09-06 10:08:53 -04:00
mccabe615 08c7800dff Update README.md
Update readme with getting started instructions
2013-09-06 10:04:25 -04:00
Michael McCabe 1f3620a3de adding rspec and auto test runs 2013-09-05 16:52:17 -04:00
cktricky 65eb2caeaf made a suggestion based on digininjas comment on Rails tutorials blog post. Better to change method name to hash_password than encrypt_password 2013-08-08 16:57:58 -04:00
cktricky c024bd6591 changed something small 2013-08-08 16:21:04 -04:00
cktricky 9533f0d098 added a task for stopping and starting rails 2013-08-08 16:17:55 -04:00
cktricky 1b9e60b982 uncessary task 2013-08-08 14:11:49 -04:00
cktricky 2a4a7a5440 that was painful but managed to install gauntlt. Turns out you need to revert to minitest 4 (not 5, for the love of humantiy, not 5). Also, added rspec (not sure that did anything). Lastly, aruba and gauntlt. So, we now have a dir explicitly for attack files. 2013-08-08 14:04:52 -04:00
cktricky 8f4644c312 new note on top 10, 2013 progress 2013-07-28 20:13:16 -04:00
cktricky ef9570c4b2 Merge branch 'master' of github.com:OWASP/railsgoat 2013-07-28 19:45:00 -04:00
cktricky f67bd0f5ed correct naming within the command injection tutorial 2013-07-28 19:44:51 -04:00
Ken Johnson 0dd84a1724 Merge pull request #38 from cmlh/license
Add LICENSE.md file
2013-07-27 05:11:24 -07:00