{"id":"GHSA-r74q-gxcg-73hx","summary":"Improper Input Validation in simple_form","details":"## Incorrect Access Control in `file_method?` in `lib/simple_form/form_builder.rb`; a user-supplied string is invoked as a method call\n\n### Impact\nFor pages that build a form using user input, it is possible for an attacker to manipulate the input and send any method present in the form object. For example:\n\n```erb\n\u003c%= simple_form_for @user do |f| %\u003e\n  \u003c%= f.label @user_supplied_string %\u003e\n  ...\n\u003c% end %\u003e\n```\n\nThe string provided in the variable `@user_supplied_string` would be invoked as a method call inside the `@user` object (unless the string contains any of the following: `password`, `time_zone`, `country`, `email`, `phone` and `url`).\n\nBy manipulation that input, an attacker could do any of the following:\n\n- Code execution (call actions like `#destroy`)\n- Denial of Service (by executing a computation intensive method)\n- Information Disclosure (check the presence of methods, leak user information)\n\n### Patches\nThe problem was fixed in version `5.0`. Although it's a major version, there should be no issues with upgrading for `4.x`. The reason it was released in a major version is that the configuration `SimpleForm.file_methods` was deprecated in order to fix the problem.\n\n### Workarounds\nThe issue only happens with pages that build forms based on user-provided input. If your application doesn't do that, you're not affected.\nA workaround is to explicitly pass which type you want for an input since the issue lies on Simple Form's automatically discovery of input types. This can be done using the `as` option, like the following:\n```erb\n\u003c%= form.input :avatar, as: :file %\u003e\n```\n\n### References\n[TDB]\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [https://github.com/plataformatec/simple_form](https://github.com/plataformatec/simple_form)\n* Email us at [opensource@plataformatec.com.br](mailto:opensource@plataformatec.com.br)","aliases":["CVE-2019-16676"],"modified":"2026-08-27T03:56:00.389261319Z","published":"2019-09-30T19:41:15Z","database_specific":{"severity":"CRITICAL","github_reviewed":true,"github_reviewed_at":"2020-06-16T21:53:49Z","nvd_published_at":null,"cwe_ids":["CWE-20"]},"references":[{"type":"WEB","url":"https://github.com/plataformatec/simple_form/security/advisories/GHSA-r74q-gxcg-73hx"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2019-16676"},{"type":"WEB","url":"https://github.com/heartcombo/simple_form/commit/8c91bd76a5052ddf3e3ab9fd8333f9aa7b2e2dd6"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-r74q-gxcg-73hx"},{"type":"PACKAGE","url":"https://github.com/heartcombo/simple_form"},{"type":"WEB","url":"https://github.com/plataformatec/simple_form/commits/master"},{"type":"WEB","url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/simple_form/CVE-2019-16676.yml"},{"type":"WEB","url":"http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-form-cve-2019-16676"}],"affected":[{"package":{"name":"simple_form","ecosystem":"RubyGems","purl":"pkg:gem/simple_form"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.0.0"}]}],"versions":["0.4.0","0.5","1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.1.0","1.1.1","1.1.2","1.1.3","1.2.0","1.2.1","1.2.2","1.3.0","1.3.1","1.4.0","1.4.1","1.4.2","1.5.0","1.5.1","1.5.2","2.0.0","2.0.0.rc","2.0.1","2.0.2","2.0.3","2.0.4","2.1.0","2.1.1","2.1.2","2.1.3","3.0.0","3.0.0.beta1","3.0.0.rc","3.0.1","3.0.2","3.0.3","3.0.4","3.1.0","3.1.0.rc1","3.1.0.rc2","3.1.1","3.2.0","3.2.1","3.3.0","3.3.1","3.4.0","3.5.0","3.5.1","4.0.0","4.0.1","4.1.0"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2019/09/GHSA-r74q-gxcg-73hx/GHSA-r74q-gxcg-73hx.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"}]}