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

Revisit CVE-2022-23121, CVE-2022-23123 regression fixes by @andychen-syno and @anodos325 #1008

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dgsga
Copy link
Contributor

@dgsga dgsga commented May 19, 2024

  • Added guard check before access ad_entry()
  • Allow zero length entry in compliance with AppleDouble specification
  • Avoid setting adouble entries on symlinks

@dgsga dgsga self-assigned this May 19, 2024
@dgsga dgsga linked an issue May 19, 2024 that may be closed by this pull request
@dgsga
Copy link
Contributor Author

dgsga commented May 19, 2024

@rdmark, this commit implements @andychen-syno's original 2022 CVE patches along with @anodos325's patch to avoid setting adouble entries on symlinks. This gives the best of both worlds with a much cleaner log, especially on classic Mac clients.

@dgsga dgsga marked this pull request as ready for review May 19, 2024 13:29
@dgsga dgsga requested a review from rdmark as a code owner May 19, 2024 13:29
…syno and @anodos325

- Added guard check before access ad_entry()
- Allow zero length entry in compliance with AppleDouble specification
- Avoid setting adouble entries on symlinks
Copy link

sonarcloud bot commented May 19, 2024

@rdmark
Copy link
Member

rdmark commented May 20, 2024

@dgsga Sorry it's taking a while to wrap my head around this changeset. I trust your judgement of course, but I also want to internalize the logic changes.

@dgsga
Copy link
Contributor Author

dgsga commented May 20, 2024

No worries, if you find any flaws please feed back. This PR is definitely optional!

@@ -1342,8 +1341,8 @@ int getdirparams(const AFPObj *obj,
break;

case DIRPBIT_FINFO :
if ( isad && (ade = ad_entry(&ad, ADEID_FINDERI)) != NULL) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn’t removing the null check for ad entry open up for invalid, and potentially insecure, AD data being stored?

* improper ops on symlink adoubles will be
* more visible (assert).
*/
if (adp && (ad_meta_fileno(adp) != AD_SYMLINK)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think disallowing symlinks is generally safer than allowing them. Is there a specific use case you have in mind, or perhaps an explicit line in the AD spec that allows this?


if (adp->ad_vers != AD_VERSION_EA) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that the check for EA style metadata was removed here. Otherwise the block’s logic seems unchanged. Is DID a valid concept for EA metadata? (I’m asking out of curiosity)

@dgsga
Copy link
Contributor Author

dgsga commented May 22, 2024

Reverted this PR to draft as want to do more research...

@dgsga dgsga marked this pull request as draft May 22, 2024 19:27
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

Successfully merging this pull request may close these issues.

Revisit CVE-2022-23121, CVE-2022-23123 regression fix
2 participants