Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Psych::DisallowedClass: Tried to load unspecified class: Symbol #374

Open
seb-sykio opened this issue Jul 13, 2022 · 5 comments
Open

Psych::DisallowedClass: Tried to load unspecified class: Symbol #374

seb-sykio opened this issue Jul 13, 2022 · 5 comments

Comments

@seb-sykio
Copy link

I updated rails to 7.0.3.1 ([CVE-2022-32224] Possible RCE escalation bug with Serialized Columns in Active Record )

now I have this issue:

`Failure/Error: @casting.create_activity(key: "xxx", owner: current_user, parameters: { email_subject: 'xxx' })

 Psych::DisallowedClass:
   Tried to load unspecified class: Symbol
 # (eval):2:in `symbol'
 # .rvm/gems/ruby-3.1.2/gems/activerecord-7.0.3.1/lib/active_record/coders/yaml_column.rb:50:in `yaml_load'`
@davidwessman
Copy link

https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017

It is mentioned that you can allow specific classes with:

config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time]

Does that help?

@davidwessman
Copy link

I have an app with both Symbol and HashWithIndifferentAccess, have anyone solved how do limit the dangerous behaviour without destroying old data?

@pandu-cls
Copy link

We realized the parameters column from the activities table is causing this problem as it was doing the serialization of the data.
Our app uses Date, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone, ActiveSupport::HashWithIndifferentAccess, BigDecimal classes. We fixed the issue by adding them to config.active_record.yaml_column_permitted_classes in application.rb.

However, we are still concerned about this problem because some other classes also can cause this problem again.

@davidwessman
Copy link

I am a bit worried about what data is accepted inside ActiveSupport::HashWithIndifferentAccess.

@pokonski
Copy link
Member

pokonski commented Jul 14, 2022

The same data as in Hash, this is just a wrapper.

And regarding the fix in the second comment, yes this is the only way to do it - you have to whitelist explicitly. This breaks Rails apps even without public_activity.

shaun-technovation added a commit to Iridescent-CM/technovation-app that referenced this issue Jan 10, 2024
From what I'm seeing this `Psych::DisallowedClass` error is somewhat
common, I fixed/addressed it by allowiing the classes the error was
complaining about, as show in these links:

- ruby/psych#564
- https://stackoverflow.com/q/71332602
- public-activity/public_activity#374

Refs: #4366
shaun-technovation added a commit to Iridescent-CM/technovation-app that referenced this issue Jan 12, 2024
From what I'm seeing this `Psych::DisallowedClass` error is somewhat
common, I fixed/addressed it by allowiing the classes the error was
complaining about, as show in these links:

- ruby/psych#564
- https://stackoverflow.com/q/71332602
- public-activity/public_activity#374

Refs: #4366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants