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

Missing underscore char "_" in whitelist in node DNS module - "resolvePtr" #40231

Closed
phakpin opened this issue Sep 27, 2021 · 3 comments
Closed
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@phakpin
Copy link

phakpin commented Sep 27, 2021

Version

12.22.5 14.17.5 all X.XX.5

Platform

AllPlatforms

Subsystem

DNS node module

What steps will reproduce the bug?

Just try to resolve domain by a pointer that contains underscore char "_".

How often does it reproduce? Is there a required condition?

Every time.

What is the expected behavior?

Domain should be resolved :)

What do you see instead?

errno: 'EBADRESP',
code: 'EBADRESP',
syscall: 'queryPtr',

Additional information

So the problem is related directly to fix for those vulnerabilities CVE-ID: CVE-2021-3672, CVE-2021-22931 - 5f947db68c
especially this new function is problematic:

static int is_hostnamech(int ch)
{
  /* [A-Za-z0-9-.]
   * Don't use isalnum() as it is locale-specific
   */
  if (ch >= 'A' && ch <= 'Z')
    return 1;
  if (ch >= 'a' && ch <= 'z')
    return 1;
  if (ch >= '0' && ch <= '9')
    return 1;
  if (ch == '-' || ch == '.')
    return 1;
  return 0;
}

So allow list doesn't contain underscore char "_". It's easy to fix that by changing last "if" to: if (ch == '-' || ch == '.' || ch == '_').
The question is if this is by design or just oversight.
It's critical in our business because our domains contain underscore. Do you able to fix that?

@thunder-coding
Copy link
Contributor

This has been already fixed upstream c-ares/c-ares@5c995d5#diff-d5f0115462852e53122bb8acffb14015df473bc321f1e7eca7d6dadce474208c,

Should be fixed as soon as a new version is released by upstream amd nodejs updates to use newer c-ares

@phakpin
Copy link
Author

phakpin commented Sep 27, 2021

Thanks for answer!

@Ayase-252
Copy link
Member

I'm closing this as duplicate of #39780.

As @thunder-coding mentioned, it will be fixed when upstream releases.

@Ayase-252 Ayase-252 added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

3 participants