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

Fuzzing candidates #2

Open
mschwager opened this issue Jan 19, 2024 · 8 comments
Open

Fuzzing candidates #2

mschwager opened this issue Jan 19, 2024 · 8 comments

Comments

@mschwager
Copy link
Member Author

It looks like json, psych, and date are already fuzzed here: https://github.com/google/oss-fuzz/tree/master/projects/ruby.

zlib could be interesting, although that extension appears to be a direct copy of the ubiquitous Zlib C library, so it's probably already been fuzzed extensively.

@woodruffw
Copy link
Member

woodruffw commented Jan 30, 2024

nokogiri (especially the SAX parser) is also worth fuzzing, they have a long track record of NPEs and other memory violations: https://www.cvedetails.com/vulnerability-list/vendor_id-20514/product_id-59208/Nokogiri-Nokogiri.html

Edit: Fuzzed here: https://github.com/google/oss-fuzz/tree/master/projects/nokogiri

@mschwager
Copy link
Member Author

nokogiri (especially the SAX parser) is also worth fuzzing, they have a long track record of NPEs and other memory violations: https://www.cvedetails.com/vulnerability-list/vendor_id-20514/product_id-59208/Nokogiri-Nokogiri.html

Edit: Fuzzed here: https://github.com/google/oss-fuzz/tree/master/projects/nokogiri

Good call, looks like they're only doing UBSAN though? https://github.com/google/oss-fuzz/blob/master/projects/nokogiri/project.yaml#L9-L10

@woodruffw
Copy link
Member

Yeah, interesting choice 🤔

@woodruffw
Copy link
Member

The ffi gem might also be worth fuzzing: https://github.com/ffi/ffi

@mschwager
Copy link
Member Author

Here's a useful GH query for finding repositories with a extconf.rb file (indicates a Ruby C extension): https://github.com/search?q=lang%3Aruby+path%3Aextconf.rb+NOT+is%3Aarchived&type=code.

@mschwager
Copy link
Member Author

OSS-Fuzz was doing some non-Ruzzy Ruby fuzzing, but that's since been removed: google/oss-fuzz#12715. Here were the stdlibs being fuzzed:

static void init_date_strptime(struct TargetFunction *target) {
  static const enum RubyDataType argTypes[2] = {RDT_CString, RDT_CString};
  init_TargetFunction(target, "date", "Date", "strptime", ARRAYSIZE(argTypes),
                      argTypes);
}

static void init_date_httpdate(struct TargetFunction *target) {
  static const enum RubyDataType argTypes[1] = {RDT_CString};
  init_TargetFunction(target, "date", "Date", "httpdate", ARRAYSIZE(argTypes),
                      argTypes);
}

static void init_date_parse(struct TargetFunction *target) {
  static const enum RubyDataType argTypes[1] = {RDT_CString};
  init_TargetFunction(target, "date", "Date", "parse", ARRAYSIZE(argTypes),
                      argTypes);
}

static void init_regexp_new(struct TargetFunction *target) {
  static const enum RubyDataType argTypes[1] = {RDT_CString};
  init_TargetFunction(target, "regexp", "Regexp", "new",
                      ARRAYSIZE(argTypes), argTypes);
}

static void init_json_parse(struct TargetFunction *target) {
  static const enum RubyDataType argTypes[1] = {RDT_CString};
  init_TargetFunction(target, "json", "JSON", "parse", ARRAYSIZE(argTypes),
                      argTypes);
}

static void init_psych_parse(struct TargetFunction *target) {
  static const enum RubyDataType argTypes[1] = {RDT_CString};
  init_TargetFunction(target, "psych", "Psych", "parse", ARRAYSIZE(argTypes),
                      argTypes);
}

static void init_openssl_read(struct TargetFunction *target) {
  static const enum RubyDataType argTypes[1] = {RDT_CString};
  init_TargetFunction(target, "openssl", "OpenSSL::PKey", "read",
                      ARRAYSIZE(argTypes), argTypes);
}

static void init_openssl_read_smime(struct TargetFunction *target) {
  static const enum RubyDataType argTypes[1] = {RDT_CString};
  init_TargetFunction(target, "openssl", "OpenSSL::PKCS7", "read_smime",
                      ARRAYSIZE(argTypes), argTypes);
}

static void init_openssl_sprintf(struct TargetFunction *target) {
  static const enum RubyDataType argTypes[2] = {RDT_CString, RDT_CString};
  init_TargetFunction(target, "openssl", "Kernel", "sprintf",
                      ARRAYSIZE(argTypes), argTypes);
}

static void init_CGI_unescapeHTML(struct TargetFunction *target) {
  static const enum RubyDataType argTypes[1] = {RDT_CString};
  init_TargetFunction(target, "cgi", "CGI", "unescapeHTML", ARRAYSIZE(argTypes),
                      argTypes);
}

We could pick up where it left off.

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

2 participants