This Website Accidentally Left Promo Codes in Their Source Code | by Jacob Bergdahl | JavaScript in Plain English


AI Summary Hide AI Generated Summary

Accidental Exposure of Promo Codes

A blog post details the discovery of several promo codes accidentally left exposed in the publicly accessible source code of the Great Wolf Lodge website. The author explains how by inspecting the source code and searching for terms like 'promocode', they were able to locate variables containing partial URLs and arrays of promo codes.

Accessing and Testing the Codes

Following the discovered URLs, the author found a JSON file containing four distinct promo codes. One of these codes was successfully tested on the website, demonstrating the vulnerability.

Key Findings

  • Publicly accessible source code can reveal sensitive information, including promo codes.
  • The Great Wolf Lodge website had a security vulnerability resulting from poor coding practices.
  • Simple search methods within the source code can be effective in finding exposed information.

The article serves as a cautionary tale about the importance of proper security measures in web development and highlights the potential risks associated with exposing internal data.

Sign in to unlock more AI features Sign in with Google

This Website Accidentally Left Promo Codes in Their Source Code

Some time ago, I exposed an e-shop for blatantly lying about the number of people viewing their products. Their public source code contained a JavaScript function that randomized the number. Since then, the administrators of the e-shop have quietly removed the code from their website.

Well, we are once again exploring the source code of a website, but this time there’s nothing crooked involved. The website that I’ll be showing you today simply exposed hidden promo codes in their public code.

We’ll be looking at a chain of indoor water parks called Great Wolf Lodge today, though I want you to know that it’s actually quite common that websites expose what would be internal information publicly through poor code.

I’ll explain every step along the way, so you can follow along and use the methods I mention in this article to explore the source codes for other websites. And, trust me, you can find all sorts of interesting tidbits in source codes.

Here’s what we’ll do:

  1. We will take a look at the source code for Great Wolf, where we will find references to promo codes which we will check out.
  2. We will try one of the promo codes on the website and snatch a URL to a web server.
  3. Spoiler: in the end, we do find a promo code that works.

Exploring the Source Code

Let’s start by navigating over to our subject: Great Wolf. Right-click just about anywhere on the website and select “View source.” Hit CTRL+F (or CMD+F) to search the code and type “promocode.” We will find two variables in particular that interest me: “dealPromoCodeApiUrl” and “promoCodeList.” The first variable contains a partial URL to a JSON-file (a file with some structured data) that sounds like it would contain promo codes. The second variable is an array (a collection) of promo codes.

If we take the URL found in the aforementioned variable and add “greatwolf.com” to the beginning of it, we’ll end up with this URL: https://www.greatwolf.com/content/experience-fragments/gwl/poconos/experience-fragment/master/_jcr_content/root/plan.json.

At the time of writing, upon visiting that URL, I am greeted with four different promo codes:

Was this article displayed correctly? Not happy with what you see?

Tabs Reminder: Tabs piling up in your browser? Set a reminder for them, close them and get notified at the right time.

Try our Chrome extension today!


Share this article with your
friends and colleagues.
Earn points from views and
referrals who sign up.
Learn more

Facebook

Save articles to reading lists
and access them on any device


Share this article with your
friends and colleagues.
Earn points from views and
referrals who sign up.
Learn more

Facebook

Save articles to reading lists
and access them on any device