News for hackers. Stuff that matters.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Monday June 24, 2019 @12:20PM (#20265158)
Hey HN!

I created GuardScript because in my previous company we started to include more and more third-party Javascript from SaaS services on our homepage, and this created security risks for us [1] [2].

In order to reassure us, a few of these companies created independently what is essentially GuardScript: a service that monitors every few minutes any changes made to your Javascript files and sends you a notification with the changes made. You can then detect any malicious modification by analyzing these results.I decided to build it for a broader audience.

I'd love feedback and suggestions on how to make it better.

Thanks!

[1] https://www.theregister.co.uk/2018/09/12/feedify_magecart_ja [2] https://www.zdnet.com/article/hackers-breach-statcounter-to-...

Re:Show HN: Guardscript – Detect any changes made to your Ja... by ben509 on Monday June 24, 2019 @08:56PM (#20270189)
What do you actually do about an alarm? Okay, I just got an email, check there's no release planned, I go through the diff and, oh crap, my customers are being pwned. Now I'm going to have to drop everything and manually disable those URLs until I can contact the maintainer of this service? I guess that's the unfortunate reality when using SaaS.

I'd want a runbook feature so that anyone getting the email has a procedure to:

* check release notes to identify a false alarm

* if not identify which source files the URL is used in

* disable those URLs

* flush caches

* confirm they're disabled

* contact the service provider

* roll back when upstream is fixed

Or something like that. Man, I do not miss ops work.

Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Tuesday June 25, 2019 @01:59AM (#20271541)
You are right, for now all the analysis should be done by the owner of the script. I'll think about adding a runbook...
Re:Show HN: Guardscript – Detect any changes made to your Ja... by netsharc on Monday June 24, 2019 @08:30PM (#20270036)
So as a hacker, I will just need to hack statcounter to serve your IP the non-molested JS, and almost everyone else the bad JS, right?
Re:Show HN: Guardscript – Detect any changes made to your Ja... by jjeaff on Tuesday June 25, 2019 @12:01AM (#20271073)
If you want to mitigate that, you simply need to run this from, or proxy the request through, some other random ip address.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by ben509 on Monday June 24, 2019 @08:31PM (#20270041)
Under "pricing" all the "start" buttons say "sart". (Checked Chrome and FF.)
Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Tuesday June 25, 2019 @01:45AM (#20271483)
Thank you! I have changed it.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by BubRoss on Monday June 24, 2019 @09:26PM (#20270351)
Why wouldn't someone just detect changes to the files at the OS level?
Re:Show HN: Guardscript – Detect any changes made to your Ja... by godzillabrennus on Monday June 24, 2019 @09:40PM (#20270434)
Not all hosts give you control at the OS level.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by jjeaff on Tuesday June 25, 2019 @12:02AM (#20271077)
It sounds like this is talking about 3rd party scripts included in the page. Like Google analytics and the like.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Tuesday June 25, 2019 @01:46AM (#20271488)
Exactly.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by jhgg on Tuesday June 25, 2019 @01:03AM (#20271337)
>GuardScript is usefull when Subressource integrity is not feasible or not implemented, which is most of the time for SaaS services.

Can you explain what this means?

Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Tuesday June 25, 2019 @01:45AM (#20271482)
Well many companies that offer you a service don't include the Subresource integrity Tag.

Check for instance Stripe : <script src="https://js.stripe.com/v3"></script> or Facebook : <script async defer src="https://connect.facebook.net/en_US/sdk.js"></script>

If they offer you a javascript and it has to change frequently to fix bugs, for instance, they don't want to be bothered with having to coordinate with all their customers to change the subresource integrity tag...

In this case our service could be an alternative.

Re:Show HN: Guardscript – Detect any changes made to your Ja... by leppr on Monday June 24, 2019 @08:26PM (#20270004)
Suggestion: Monitor other potential attack vectors like CSS files.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Tuesday June 25, 2019 @01:46AM (#20271486)
Thanks for the suggestion
Re:Show HN: Guardscript – Detect any changes made to your Ja... by leppr on Monday June 24, 2019 @08:25PM (#20269995)
This is good, but this won't stop the first few visitors from getting pwned. Client-side check (SRI) is still the best solution.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Tuesday June 25, 2019 @01:49AM (#20271497)
You are right. SRI is the best solution and I mention it in the FAQ. Unfortunately, it can't always be implemented. See my previous comment :

Well many companies that offer you a service don't include the Subresource integrity Tag. Check for instance Stripe : <script src="https://js.stripe.com/v3"></script> or Facebook : <script async defer src="https://connect.facebook.net/en_US/sdk.js"></script>

If they offer you a javascript and it has to change frequently to fix bugs, for instance, they don't want to be bothered with having to coordinate with all their customers to change the subresource integrity tag...

In this case, our service could be an alternative.

Re:Show HN: Guardscript – Detect any changes made to your Ja... by missblit on Monday June 24, 2019 @11:42PM (#20271002)
> How do you detect the modifications? We compute the hashes of the files regularly. If only one character in a file changes, his hash will change.

Does this include HTTP headers? For instance a yay.js framework that helps people print 'yay' to the console could return:

  HTTP/1.1 301 MOVED PERMANENTLY
  LOCATION: http://evil.evil/evil.js
  
  console.log('yay!');
Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Tuesday June 25, 2019 @01:54AM (#20271526)
No it does not include the headers. Only the js file downloaded.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by godzillabrennus on Monday June 24, 2019 @09:42PM (#20270442)
Pricing seems high to me. A sub $10/month plan that lets someone check 30 files once a day or even once a week would be useful.

Plenty of small companies have god awful Wordpress sites with a ton of insecure JavaScript files. They don’t need to be checked every 10 minutes but they do need something to check.

Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Tuesday June 25, 2019 @01:55AM (#20271527)
Thanks for the suggestion.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by dmitrygr on Monday June 24, 2019 @08:01PM (#20269826)
I get relying on 3rd party libraries, but not hosting them yourself and just hoping that the current host never gets sold/owned/etc? That sounds insane to me...

Sounds like curl | insmod /dev/stdin level insane

Re:Show HN: Guardscript – Detect any changes made to your Ja... by GhostVII on Monday June 24, 2019 @11:43PM (#20271006)
Sounds pretty insane to me too, but I think it is valuable to let people do insane things more securely, as I don't think security concerns are generally a very big deterrent in software development (unfortunately).
Re:Show HN: Guardscript – Detect any changes made to your Ja... by ben509 on Monday June 24, 2019 @08:35PM (#20270057)
Some 3rd party services, though, serve up libraries, e.g. disqus.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by koolba on Monday June 24, 2019 @09:36PM (#20270407)
And those 3rd party libs can dynamically load other files via script tags. The first level does not even have to change for dynamically loaded scripts to change.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by jjeaff on Tuesday June 25, 2019 @02:47AM (#20271711)
Lots of 3rd party services don't allow you to host your own copy of their library.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by stephenr on Tuesday June 25, 2019 @12:15AM (#20271124)
Apart from the "SaaS services" (I mean, are they really services for services?), this seems to boil down to:

"We can't trust SaaS.... so we built a SaaS to alert you when the JS delivered by your SaaS changes...". So now you have to trust this SaaS to tell you that the other SaaS is still trustworthy.

Re:Show HN: Guardscript – Detect any changes made to your Ja... by quickthrower2 on Tuesday June 25, 2019 @12:50AM (#20271281)
That's the premise behind most security software. We can't trust the internet, so download a firewall from the internet to block traffic from the internet.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by stephenr on Tuesday June 25, 2019 @01:16AM (#20271389)
The software you download is generally signed by a party that you do trust though, and then runs locally on your computer.

And of course, that also doesn't really apply if you're using an operating system that includes a firewall by default.

Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Tuesday June 25, 2019 @01:53AM (#20271520)
For now, Guardscript Goal is for the different SaaS services to use it, not for the individual website owners to use it to monitor the JS of SaaS services.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by pietroglyph on Monday June 24, 2019 @09:19PM (#20270313)
Looks very cool. You have a typo in the pricing area of the page: it says "Sart Free Trial" instead of "Start Free Trial".
Re:Show HN: Guardscript – Detect any changes made to your Ja... by Dyaz17 on Tuesday June 25, 2019 @01:56AM (#20271532)
Thank you, I have corrected it
Re:Show HN: Guardscript – Detect any changes made to your Ja... by snek on Monday June 24, 2019 @10:12PM (#20270580)
Imagine an internet where instead of making this tool, people stopped including billions of third party scripts.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by leppr on Monday June 24, 2019 @10:17PM (#20270606)
Imagine an operating system where instead of making this tool, people stopped including billions of third party libraries.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by graphememes on Monday June 24, 2019 @11:17PM (#20270883)
You could do this with a free serverless function on aws, why would I pay for it
Re:Show HN: Guardscript – Detect any changes made to your Ja... by viraptor on Monday June 24, 2019 @11:46PM (#20271020)
To save time you'd otherwise spend writing and testing the serverless function. This applies to literally every SaaS.
Re:Show HN: Guardscript – Detect any changes made to your Ja... by graphememes on Tuesday June 25, 2019 @04:15PM (#20278425)
This isn't particularly a hard thing to do, and the testing framework is pretty much baked into AWS. There are libraries to do this already.

You do you though.