انتقل إلى المحتوى الرئيسي

يبقى هذا المحتوى بلغته الأصلية (الإنجليزية). لا تُترجم الأبحاث ودراسات الحالة والنصوص القانونية آليًا أبدًا. ترجمة الواجهة العربية قيد المراجعة.

دراسة حالة · Third-party JavaScript, Web security, Supply-chain risk, Content Security Policy

AIIMS Delhi Website Ad Injection: A Historical Third-Party JavaScript Case Study

In December 2022 a visitor-counter script on the official AIIMS Delhi website was found to be placing third-party advertising at the top of the page. This case study reconstructs what happened from the original report and from archived copies of the script, separates verified facts from interpretation, and sets out what the episode teaches about third-party JavaScript.

بقلم PrajnaBytesنُشر في قراءة في 17 دقيقة

Content reference
aiims-delhi-website-third-party-javascript-ad-injection (no incident or vulnerability identifier was assigned)
Investigation period
Issue reported as discovered on 25 December 2022; archived evidence spans 2018 to January 2023
Original report
Published 21 January 2023 on isrgrajan.com (updated 28 August 2024)
Case study published
5 November 2026
Category
Third-party JavaScript security; unwanted ad injection
Affected website
aiims.edu, the official website of the All India Institute of Medical Sciences, New Delhi
Third-party component
Visitor counter served from counter.websiteout.net (WebsiteOut)
Research attribution
Isrg Rajan, acting individually (identified in the original report as founder of Isrg KB)

النتائج الرئيسية

  • The AIIMS Delhi site footer loaded a visitor-counter script from counter.websiteout.net, which is visible in archived copies of the page from early 2019 to 12 January 2023.
  • Archived responses from the counter URL alternate between a counter-only version and a larger version that writes a fixed-position Google AdSense unit at the top of the host page.
  • The AdSense publisher ID in the script matches the one listed in websiteout.net/ads.txt, which indicates the advertising was configured by the counter operator rather than by AIIMS.
  • The counter is absent from archived copies of the page from 27 January 2023 onward, which is consistent with the reported removal.
  • The archived code shows ad insertion and interference with the host page. It does not show server compromise, credential theft or malware delivery, and the case is unrelated to the separate ransomware incident at AIIMS.

Executive summary

The official website of AIIMS Delhi included a free visitor counter in its footer. The counter was not a static image: it was a script loaded from the counter provider's server, counter.websiteout.net, and it ran with the same access to the page as AIIMS's own code.

On 25 December 2022, Isrg Rajan reported finding advertising on the site that the institution had not placed there. He traced it to the counter, wrote to the Director of AIIMS describing the risk and the source, and offered help with removal. His findings were published on 21 January 2023, and the article reports that the AIIMS IT Cell removed the component.

For this case study we re-examined the evidence using archived copies held by the Internet Archive. The archives independently confirm the counter's presence on the AIIMS site, the content of the ad-inserting script, the match between its advertising account and the operator's ads.txt file, and the counter's disappearance from the site in late January 2023.

The evidence supports a narrower description than the original headline. This was unwanted advertising injected by a third-party script that the website had itself included. It was not an infection of AIIMS servers, adware installed on visitors' devices, or a software vulnerability in the usual sense. The risk was real nonetheless: any external script can change what a trusted public website shows its visitors, and this one did.

Background

Hit counters were a common feature of institutional websites. Many free counter services work by embedding a small image, but some ask the site owner to embed a <script> tag. A script delivered from another domain is not isolated from the page that includes it. It can read and change the page's content (the DOM), add new elements and load further scripts, and the browser treats all of this as the website's own behaviour.

That is the core of third-party JavaScript risk. The site owner reviews the snippet once, but the code that actually runs is whatever the provider's server returns on each request, and the provider can change it at any time without the site owner's knowledge.

The original report used the word "adware". Several related terms are often used loosely, so it helps to be precise about which of them apply here.

Terminology and whether it applies to this case

Term Meaning Applies here?
Adware Software, usually installed on a user's device, that displays unwanted advertising Only loosely. Nothing was installed on visitors' devices; the advertising came from a script embedded in the website.
Ad injection Inserting advertising into a page without the page owner's intent Yes. This is the most accurate description of the observed behaviour.
Third-party script abuse An embedded external script doing more than the purpose it was added for Yes. A visitor counter also inserted ads and modified the host page.
Malvertising Advertising used to deliver malware or fraudulent redirects Not established. The ads were served through Google AdSense, and no malicious ad content was documented.
Malicious JavaScript Code designed to harm users, such as stealing data or delivering exploits Not established by the archived code, although the script had the capability to do so had its operator chosen.
Website compromise Unauthorised modification of a site's own servers or files No. AIIMS's own pages loaded the counter by design; the change happened on the provider's server.
Browser redirection Sending a visitor to another site without their action Not observed. The "redirect" in the original report refers to how the counter image was served and to the operator's own domains.
Ransomware Malware that encrypts systems and demands payment No. The separate ransomware attack on AIIMS systems is unrelated to this case.

Separate incident. The original article opens with background about the ransomware attack that disrupted AIIMS systems in late 2022. That incident is not part of this case study. No evidence links the visitor counter to the ransomware attack, and this research neither discovered nor remediated it.

What the investigator reported

The original article, published 21 January 2023 under the byline Registrar Bureau, documents the following findings. The next section sets out which of them are confirmed by archived evidence.

  • The site aiims.edu used a third-party hit counter from websiteout.net.
  • The counter loaded an image from counter.websiteout.net/compte.php, with the AIIMS hostname and a counter ID in the query string.
  • It also loaded a script, counter.websiteout.net/close-firstchild.js, which the author described as able to add and load content on the host site. An archived copy was cited.
  • A screenshot showed an advertisement above the AIIMS Delhi header, captioned as an ad injected by websiteout.net.
  • The ads used Google AdSense publisher ID pub-5486891678306037, the same ID listed in websiteout.net/ads.txt. An archived copy was cited.
  • websiteout.net redirected to websiteout.ca, and archived WHOIS records were cited to link the two domains.
  • The investigator wrote to the Director of AIIMS, explaining the risks, identifying the source and offering a solution and help to the AIIMS IT Cell.
  • The AIIMS IT Cell then removed the component.

Technical observations from archived evidence

The observations below come from archived copies of the files, read as plain text, and from the Internet Archive's capture index. No historical script was executed, and AIIMS's current systems were not accessed or tested.

How the counter was embedded

Archived copies of aiims.edu/en.html show the counter in the site footer, next to the text "You are Visitor No.", as a script tag loading //counter.websiteout.net/js/30/10/22368976/0. The embed is absent from the January 2018 capture we checked and present in captures from January 2019 through 12 January 2023. The original report describes close-firstchild.js and compte.php, which are loaded by this script rather than embedded directly.

Two versions of the same script

The Internet Archive holds many captures of the counter URL from 2022. They contain two distinct responses. One is about 220 bytes and does only what a counter should: it writes a link and the counter image. The other is about 2.7 KB, begins with the same counter code, and then inserts advertising. Captures of both versions appear throughout 2022, sometimes days apart. The archives do not show why the server returned one or the other. It may have depended on the requester, timing or other conditions.

This matters for anyone assessing third-party code. A one-off review of the URL could easily have returned the harmless version.

What the ad-inserting version does

Behaviour of the ad-inserting counter script (capture of 20 December 2022)

Behaviour in the code Effect on the host page
Writes the counter link and image Displays the visitor count, which is the intended function
Sets window.onload to null Can cancel a page-load handler that the host site had registered
Removes the first iframe on the page Can remove an embedded map, video or form belonging to the host site
Removes elements with classes such as adsbygoogle, header-ads, notice and notice-overlay Can remove the host page's own ads and notice banners
Contains branches that apply only to specific other hostnames Shows the same script was tailored for other websites as well
Writes a position:fixed container at the top-left of the page with a near-maximum z-index Places content above everything else on the page
Sets a 728×90 Google AdSense unit for publisher ca-pub-5486891678306037 and loads Google's ad script Shows an ad that earns revenue for the counter operator's AdSense account
Loads close-firstchild.js Moves the ad container to the start of the page body
window.onload=null;
xx=doc.getElementsByTagName("iframe");
if (xx.length) xx[0].parentNode.removeChild(xx[0]);
removeByClassName("adsbygoogle");
…
doc.write('<div id="ChromeBrowser" style="position:fixed;top:0px;left:0px;width:750px;…;z-index:2147483644;">');
google_ad_client = "ca-pub-5486891678306037"; …
… src="//pagead2.googlesyndication.com/pagead/show_ads.js" …
… src="//counter.websiteout.net/close-firstchild.js" …

Abridged excerpt of the ad-inserting version (archived 20 December 2022). Lines not needed to understand the behaviour are omitted, and split string concatenations are joined for readability.

The role of close-firstchild.js

The archived copy of close-firstchild.js cited by the original report (captured 28 December 2022) is short. It closes an open div, moves the element with ID ChromeBrowser to the beginning of the page body, and after one second repeats the move and calls a helper to remove further elements by class name. The helper is defined in the counter script, not in this file. On its own, the file repositions an element. The advertising is created by the counter script that loads it.

Comparing captures shows the container was renamed between 28 November and 20 December 2022 from the meaningless ggoggo to ChromeBrowser, and close-firstchild.js was updated to match. Apart from that rename, the 2018 and 2022 versions of close-firstchild.js are functionally identical, which suggests the mechanism existed long before the report. The archives do not show when the ad-inserting version was first served to the AIIMS site.

Corroborating details

  • The screenshot in the original report shows a banner advertisement, with ad-choice and close controls, above the AIIMS Delhi header at aiims.edu/en.html. This matches the fixed top-left placement in the code.
  • The archived websiteout.net/ads.txt (1 January 2023) contains a single line authorising Google publisher pub-5486891678306037, the account named in the script.
  • WebsiteOut's current website describes a French web-hosting business operating since 1999 and mentions visitor counters among its offerings. We could not locate the terms that applied to its free counter in 2022, so we cannot say whether advertising was disclosed to counter users.

What the archived code does not show

The archived files show no exploit code, credential or form capture, file downloads, cryptocurrency mining or automatic redirection of visitors. The specific advertisements served through AdSense are chosen dynamically and are not preserved, so their content cannot be assessed beyond the one ad in the original screenshot, which promoted an online teaching platform.

Security analysis

We separate what the evidence shows from what can reasonably be inferred from it.

Observed facts compared with inferred risks

Observed (archived evidence) Inferred security consequence
An external script ran on the AIIMS site with full access to the page The provider could change the site's content for every visitor without any change to AIIMS's servers
The script inserted advertising above the institutional header Visitors could reasonably take the advertising as endorsed by a national medical institution
The script removed iframes and other page elements and cleared window.onload Legitimate site features could break unpredictably, and the code went well beyond counting visits
The response alternated between a benign and an ad-inserting version Point-in-time reviews could miss the behaviour, so continuous monitoring was needed to detect it
Google's ad script was loaded into the page Visitors' browsers made requests to an advertising network the institution had not chosen, which has privacy implications

Was the script malicious?

That depends on the definition. The code inserted unrequested advertising into a host site, removed the host's own elements and earned revenue from the host's traffic. Most site owners would treat that as abusive, and it was unacceptable on an official healthcare website. However, the archived code does not attack visitors' devices or data, and we found nothing to show that the operator used the access more harmfully. We therefore describe it as unwanted ad injection by a third-party script, not as malware.

Why the risk was serious anyway

The concern is the capability as much as the observed behaviour. Whoever controlled counter.websiteout.net could have replaced the advertising with a fake appointment form, a payment page or a malicious redirect, and it would have appeared on the AIIMS website. On a site that patients use to find appointments and health information, misleading content carries higher stakes than on an ordinary website. The original report raised this concern, and it remains the central lesson.

Supply-chain exposure

  • Inherited trust: a script tag gives the provider the same authority in the browser as the site owner's code.
  • Mutable content: the code at a URL can change at any time, so approving a snippet does not approve future versions.
  • Conditional serving: as this case shows, the provider can return different code to different requests.
  • Availability and performance: the script used document.write, which browsers and Lighthouse discourage because it blocks page parsing and is unreliable.
  • Hidden scope creep: a component added for one purpose (counting visits) can gain unrelated behaviour (advertising) without the site owner being told.

Corrections to the original report

  • The original article states that ads.txt was made mandatory in 2021. Google's current AdSense documentation says use of ads.txt is not mandatory but highly recommended. The absence of an ads.txt file on aiims.edu is therefore not significant in itself.
  • The article describes the ads as health-related. The one documented example promoted an online teaching platform. AdSense selects ads dynamically, so health-related ads may have appeared but were not documented.
  • The article suggests that owning several domains may indicate concealment. Owning both a .net and a .ca domain is common business practice, and we do not draw any inference from it.
  • The headline describes an adware infection and a vulnerability. The evidence supports the narrower finding of ad injection through an included third-party script.

Defensive controls and their limits

No single control would necessarily have prevented this incident, and blocking all external JavaScript is neither practical nor necessary for most organisations. The controls below reduce the risk and make problems easier to detect. Each has limitations.

Applicable controls

Control How it helps Limitations in this case
Third-party script inventory and review Records every external script, its owner, purpose and data access, and prompts the question of whether it is still needed A review captures one moment. The benign version of this counter would probably have passed.
Removal or first-party replacement A visitor count can be produced from server logs or first-party analytics without any external script Requires a small amount of internal effort. This is the most effective option for low-value widgets.
Content Security Policy (CSP) A script-src allowlist that permits the counter's domain but not the ad network's would have stopped the second-stage ad script, and violation reports would have raised an alert A permitted domain can still serve any code from that domain, including code that changes the DOM. CSP needs careful upkeep and could not have stopped DOM manipulation by the counter script itself.
Subresource Integrity (SRI) Pins a script to a known hash so that a modified file is refused Suited to versioned static files. For a vendor endpoint that changes, SRI turns every vendor update into a breakage. That fails safe, but it is often impractical.
Sandboxed iframe isolation Loading a widget in a sandboxed iframe on a separate origin stops it from reaching the host page's DOM Does not suit script-based widgets designed to write into the page. Ads can still appear inside the frame.
External resource monitoring Regularly rendering key pages and fingerprinting third-party responses detects new domains, new scripts and changed code Needs repeated sampling because responses can vary, and someone must act on the alerts.
Disclosure channel and incident response A published security contact (for example a security.txt file under RFC 9116) and a defined process help outside reports reach the right team quickly Does not prevent issues. Its value depends on how quickly reports are triaged.

Responsible disclosure

According to the original report, the investigator identified the issue on 25 December 2022 and wrote to the Director of AIIMS. The letter explained the risks, including the possibility of malicious code being inserted, identified the third-party source and proposed a fix, with an offer of help to the AIIMS IT Cell.

The report gives no date for the letter and does not publish it or any reply. It does not describe the channel used beyond a letter to the Director, and it does not record an acknowledgement from AIIMS. We have not been able to locate a public statement from AIIMS about the issue. This case study therefore does not describe the institution's response beyond what the original report says.

Based on the evidence, the investigator observed publicly visible behaviour, examined publicly served files, reported the problem to the institution and published the details after the reported removal. There is no indication of access to AIIMS systems, exploitation or testing beyond viewing public pages. This was not a formal penetration test or commissioned security assessment.

Remediation

The original report states that the AIIMS IT Cell acted quickly to remove the problem after it was reported. The web archive is consistent with that account. The last capture of aiims.edu/en.html that we found containing the counter dates from 12 January 2023, and every capture from 27 January 2023 onward omits it. In the later captures the footer shows copyright and policy links without a visitor counter. The counter appears to have been removed rather than replaced.

Not independently verified. The exact removal date, the method used, whether other AIIMS pages or properties used the same counter, and whether any other changes were made could not be verified. The archive shows only that the embed disappeared from the captured page within that window. The link between the report and the removal rests on the original article. We have not examined the current AIIMS website.

Timeline

Date Event Basis
Jan 2018 to Jan 2019 Counter embed absent in a January 2018 capture of aiims.edu/en.html and present in a January 2019 capture. Web archive
Mar to Dec 2022 Captures of the counter URL alternate between the counter-only and ad-inserting versions. Web archive
20 Dec 2022 Captured counter script uses the renamed ChromeBrowser ad container. Web archive
25 Dec 2022 Investigator reports discovering the ad injection and writes to the Director of AIIMS. Original report
28 Dec 2022 close-firstchild.js archived (cited in the original report). Web archive
1 Jan 2023 websiteout.net/ads.txt archived, listing the publisher ID used in the script. Web archive
12 Jan 2023 Last capture found of aiims.edu/en.html containing the counter. Web archive
21 Jan 2023 Original report published, stating that the AIIMS IT Cell had removed the problem. Original report
27 Jan 2023 First capture found of aiims.edu/en.html without the counter. Web archive
28 Aug 2024 Original report updated, with its current headline. Original report

Lessons learned

  • Treat every external script as code you run. Including a script gives its provider the same control of the page as the site owner.
  • Maintain an inventory. Each third-party script should have a named owner, a documented purpose and a review date. Remove what no longer has a clear purpose.
  • Prefer first-party or server-side options for low-value widgets. A visitor count did not justify running an unvetted external script on a national institution's website.
  • Monitor continuously. As this case shows, third-party responses can vary, so repeated sampling and change detection are more reliable than one-off checks.
  • Use browser controls deliberately. CSP and SRI are useful where they fit, and their limits should be understood rather than assumed away.
  • Make reporting easy. A clear security contact and a defined response process allow outside observers to report issues to the right team quickly.
  • Describe incidents precisely. Accurate terms such as ad injection, compromise and malware help organisations respond in proportion and keep public reporting credible.

Conclusion

A visitor counter, one of the least significant features on a website, was able to place advertising at the top of the official website of a national medical institution. The evidence does not show a hacked server or malware on visitors' devices. It shows a common and avoidable dependency risk: an external script trusted with full control of the page used that control for purposes the site owner had not intended.

The investigation's contribution was to notice the behaviour, trace it to its source, report it to the institution and document it publicly. Archived evidence supports these core findings and is consistent with the reported removal. The episode is a useful reminder for any organisation with a public website to know which external code runs on its pages and to review that code regularly.

القيود

  • This is a reconstruction from public sources. It does not include a formal penetration test, security assessment or vulnerability report, and no vulnerability identifier or severity score applies.
  • Web archive captures are samples. They show what the archive's crawler received at particular times, which may differ from what individual visitors received.
  • We did not establish why the counter served different versions, or when the ad-inserting version first reached the AIIMS site.
  • The investigator's letter and any reply from AIIMS have not been published, and we found no public statement from AIIMS.
  • We did not review the archived WHOIS records cited in the original report, and we draw no conclusions from domain ownership.
  • We found no independent news coverage of this issue.
  • We could not establish the number of affected visitors, how long the advertising was shown or the content of most ads served, so we have not estimated them.
  • We did not examine or test the current AIIMS website or WebsiteOut's current services. Their present behaviour may differ from the historical behaviour described here.

Technology Operations covers hosting, maintenance, monitoring and security support, including reviews of the external scripts a website loads. Our software and business systems are built and maintained with dependency review in mind.

  • Technology Operations

    Hosting, domains, certificates, maintenance, monitoring, backup and security support, so that business systems stay available and maintained.

  • Software and Business Systems

    Custom web and mobile applications and business systems that replace manual processes, disconnected spreadsheets and ageing software.

اطلب مراجعة لأنظمتك

Want to know which external scripts run on your website, and what each one can do? We can review them with you.

القراءة مجانية ولا تتطلب أي بيانات. لا نطلب بيانات الاتصال إلا إذا قررت مراسلتنا.

عن هذا المنشور

المراجعة. Reconstructed from the original report and the Internet Archive captures cited below; every observation is linked to its source. Approved for publication by the PrajnaBytes administrator on 5 November 2026.

المراجع

  1. Isrg Rajan Helped Remove Adware Vulnerability from AIIMS Delhi's Official Website. isrgrajan.com (Digital Pradesh), byline Registrar Bureau. Published 21 January 2023; updated 28 August 2024.
  2. Archived counter script, ad-inserting version (counter.websiteout.net/js/30/10/22368976/0). Internet Archive Wayback Machine. Captured 20 December 2022.
  3. Archived counter script, counter-only version (same URL). Internet Archive Wayback Machine. Captured 25 November 2022.
  4. Archived close-firstchild.js. Internet Archive Wayback Machine. Captured 28 December 2022.
  5. Capture index for the counter script URL. Internet Archive CDX API. Queried 5 November 2026.
  6. Archived AIIMS Delhi English home page with counter embed. Internet Archive Wayback Machine. Captured 12 January 2023.
  7. Archived AIIMS Delhi English home page without counter embed. Internet Archive Wayback Machine. Captured 27 January 2023.
  8. Archived websiteout.net/ads.txt. Internet Archive Wayback Machine. Captured 1 January 2023.
  9. WebsiteOut home page. WebsiteOut. Accessed 5 November 2026.
  10. Ads.txt guide. Google AdSense Help. Accessed 5 November 2026.
  11. ads.txt – Authorized Digital Sellers. IAB Tech Lab. Accessed 5 November 2026.
  12. Third Party JavaScript Management Cheat Sheet. OWASP Cheat Sheet Series. Accessed 5 November 2026.
  13. Content Security Policy Cheat Sheet. OWASP Cheat Sheet Series. Accessed 5 November 2026.
  14. Content Security Policy (CSP). MDN Web Docs. Accessed 5 November 2026.
  15. Subresource Integrity. MDN Web Docs. Accessed 5 November 2026.
  16. Subresource Integrity. W3C Recommendation. Accessed 5 November 2026.
  17. Document: write() method. MDN Web Docs. Accessed 5 November 2026.
  18. Uses document.write(). Chrome for Developers (Lighthouse). Accessed 5 November 2026.
  19. RFC 9116: A File Format to Aid in Security Vulnerability Disclosure. IETF. April 2022.
  20. About PrajnaBytes. PrajnaBytes International Private Limited. Accessed 5 November 2026.

يتناول أيضًا Content Security Policy

رؤية تقنيةتنفيذ داخليقراءة في 4 دقيقة

A strict Content Security Policy for a React website, without inline styles

How the PrajnaBytes website runs a Content Security Policy with no 'unsafe-inline' for scripts or styles, while still using React, UI libraries and dynamic effects: stylesheet classes, one per-request nonce, CSS custom properties set through the CSSOM, and self-hosted assets.

  • Content Security Policy
  • Web security
  • React

عن الخدمة نفسها

رؤية تقنيةتنفيذ داخليقراءة في 4 دقيقة

A readable XML sitemap without XSLT, before Chrome removes it

Chrome removes XSLT from stable releases in version 158 (17 November 2026), and with it the usual way of making an XML sitemap readable in a browser. CSS on XML is not being removed. This is how our sitemap uses a plain CSS stylesheet instead, and what that approach cannot do.

  • XML sitemaps
  • Search engine optimisation
  • Web standards