From f67bd0f5ed4a54579726cd423321148ba5250ec0 Mon Sep 17 00:00:00 2001 From: cktricky Date: Sun, 28 Jul 2013 19:44:51 -0400 Subject: [PATCH] correct naming within the command injection tutorial --- .../layouts/tutorial/injection/_injection_command.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/tutorial/injection/_injection_command.html.erb b/app/views/layouts/tutorial/injection/_injection_command.html.erb index c53fa77..41d9dc4 100644 --- a/app/views/layouts/tutorial/injection/_injection_command.html.erb +++ b/app/views/layouts/tutorial/injection/_injection_command.html.erb @@ -89,7 +89,7 @@
-

SQL Injection - ATTACK

+

Command Injection - ATTACK

The filename portion of the benefits[upload] parameter is vulnerable to command injection. Navigate to the benefits section of the application, and choose a file to upload. Once the file is chosen, turn your intercepting proxy on, click start upload, and intercept the request. you will want to change the backup option to true (highlighted below) and inject your commands within the filename parameter (highlighted). Note: forward slashes ('/') are escaped by the original_filename method (used to extract the file name ).

@@ -122,7 +122,7 @@ Content-Disposition: form-data; name="benefits[upload]"; filename="test.rb;+mkdir+thisisatest " Content-Type: text/x-ruby-script -

SQL Injection - SOLUTION

+

Command Injection - SOLUTION

The solution is fairly simple and because this is so poorly done there are numerous ways to fix the vulnerability. One option, is to abstract a file creation method and pass it options such as the path and filename, then call it twice, once for the initial upload and another for the backup. Another option is to make a copy through the use of the FileUtils.