Sha256: 0dbcd98a74afc2ec49286f32f331346bfa48b83409f71737db4bce5617b00759

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

---
gem: activeresource
cve: 2020-8151
url: https://groups.google.com/forum/#!topic/rubyonrails-security/pktoF4VmiM8
title: activeresource Gem for Ruby lib/active_resource/base.rb element_path Lack of Encoding
date: 2020-05-05
description: |
  activeresource contains a lack of encoding flaw in the element_path function of
  lib/active_resource/base.rb.
  
  There is an issue with the way Active Resource encodes data before querying the back end server.  This encoding mechanism can allow specially crafted requests to possibly access data that may not be expected.

  Impacted code will look something like this:

  ```
  require 'activeresource'

  class Test < ActiveResource::Base
    self.site = 'http://127.0.0.1:3000'
  end

  Test.exists?(untrusted_user_input)
  ```

  Where untrusted user input is passed to an Active Resource model.  Specially crafted untrusted input can cause Active Resource to access data in an unexpected way and possibly leak information.

  Workarounds
  -------------
  
  For those that can't upgrade, the following monkey patch can be applied:
  
  ```
  module ActiveResource
   class Base
     class << self
       def element_path(id, prefix_options = {}, query_options = nil)
         check_prefix_options(prefix_options)

         prefix_options, query_options = split_options(prefix_options) if query_options.nil?
         "#{prefix(prefix_options)}#{collection_name}/#{URI.encode_www_form_component(id.to_s)}#{format_extension}#{query_string(query_options)}"
       end
     end
   end
  end
  ```

patched_versions:
  - ">= 5.1.1"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bundler-audit-0.7.0.1 data/ruby-advisory-db/gems/activeresource/CVE-2020-8151.yml