By Gtoniser on Monday 6 February 2017 10:27 - Comments (10)

Category: Algemeen, Views: 24.126

You preregister before the sale of the event starts On the day of the event, you open your personal link, and wait in the queue for a chance to buy tickets When you're lucky, you get through the queue to buy tickets.

https://worldwide-ticket-sale.tomorrowland.com/?AnalyticsID=UA-37589046-1&#pld=eJxNjksOwjAMRK9SZQ0oLX9WFLFCwBUi0xgalE-VuBIV4u7UYYPlzbzxWPMWXRs8Kt-7G0axK4Qsq_liuVpvtmJSiMbQwLR2iTBqcAzvJiZSHhyydQqtZ2rhDx4DMnug17-3JcsuJAKrmqDzUTlOfWADtI6YEsPLkCgiUpETNxOpVRooByop5VSW4-ZuofcUc73rmQE6MJblc6y0xxe4zuKsCU58viYmRGI=



1 2 3 4 5 import zlib import base64 pld = 'eJxNztsKwjAMBuBXGb1WaefZKx0TRPAZSlzjVulhtB04xHd3qTeG3ORLCP-b9Z13KN1g7xjYoWBclMvVerPd7dmsYI1OI2mNrrgAtGQPHWKSDizS5uo7R2rgD2uPZC069fsqaOx9TGBk41U-ElOdKlqAUgFjJLyNMQXERHzXIXVSQcrnJed8zsXUOZgfXAo5W3UmQAva0PicAh3xBbY3uGi8ZZ8v7-xDCA==' regdata = zlib . decompress ( base64 . b64decode ( pld , "-_" )) print regdata Python:

{"phone_number": "0123456789", "city": "Amsterdam", "first_name": "John", "last_name": "Doe", "gender": "1", "postal_code": "1111AB", "address": "Mystreet 1", "birth_date": "2000-01-01", "country": "NL", "email": "john@example.com"}

https://queue.paylogic.com/115642/2993/?AnalyticsUID=UA-37589046-1

https://queue-api.paylogic.com/json/115642/2993/

https://queue-api.paylogic.com/json/115642/2993/?now=1486231200195

{"content": {"announcements": [], "locale": "en", "enabled_languages": ["en"], "not_started_page": {"en": "<h2>The Tomorrowland WorldWide Ticket Sale has not started yet.</h2>\r

<p><span style=\"font-weight: 400;\">The Worldwide Ticket Sale for Tomorrowland 2017 starts February 4</span><span style=\"font-weight: 400;\">th</span><span style=\"font-weight: 400;\">, 17h00 (CET).</span></p>"}, "active_page_name": "sold_out", "active_page": {"en": "<h2><strong>Tomorrowland 2017 is Sold Out</strong></h2>\r

<p>Your love for Tomorrowland was phenomenal</p>\r

<p><a href=\"https://shop.globaljourney.com\" target=\"_blank\">Limited number of Global Journey Travel Packages are still available</a></p>\r

<p>Go to <a href=\"http://shop.globaljourney.com\" target=\"_blank\">shop.globaljourney.com</a></p>"}}, "start_date": "2017-02-04T17:00:00+01:00", "redirect": null, "refresh_seconds": null, "token": null}

1ca2l9+0+115642+2993+81672+66+1486227779+1486227853+8ce0c64da3a8402b9c64435573ac3a32+1ca3od+66+p-RibtHJPN76UvZQMS_iVCFfoYHTOdEX0zsitA==

https://frontoffice.paylogic.nl/?token=1ca2ks%2B1%2B115642%2B2993%2B17226%2B66%2B1486226137%2B1486226137%2Ba44d6867023e4e1c95e675e5c5970da4%2B1ca3O9%2B63%2B0_ta34ptPis4RchYM7RugipZVFYFlqSyR4kfRg%3D%3D&event_id=115642&point_of_sale_id=2993&pld=eJxNztsKwjAMBuBXGb1WaefZKx0TRPAZSlzjVulhtB04xHd3qTeG3ORLCP-b9Z13KN1g7xjYoWBclMvVerPd7dmsYI1OI2mNrrgAtGQPHWKSDizS5uo7R2rgD2uPZC069fsqaOx9TGBk41U-ElOdKlqAUgFjJLyNMQXERHzXIXVSQcrnJed8zsXUOZgfXAo5W3UmQAva0PicAh3xBbY3uGi8ZZ8v7-xDCA==

If you try refresh your token before the refresh_seconds time, it will be invalidated (this happens when you open multiple tabs with the ticket page).

When the sale starts, tokens with queue position 0 are given out by the token server. These tokens are most likely there to fool scripts, and cannot be used to buy tickets.

Making changes to your token, for example to the queue position, will make it invalid

Opening multiple browsers or incognito windows will give you multiple chances to buy a ticket.

Writing a script that requests tokens around the time the sale will start and refreshes those in the same way a browser would allows for automation of the queue system.

A few minutes prior to the event, it will start requesting tokens from the server

Once the event starts, it will discard tokens that do not have a queue position (position 0)

Once valid tokens are obtained, the script will refresh the tokens at the correct times. The script will then wait until it gets a link to the shop page to buy tickets.

Tomorrowland - Every year over a million people (as the organisation claims) try to obtain tickets for this 3-day festival in Belgium.Since the amount of tickets is considerably lower than the number of people interested, many people leave disappointed after the ticket sale every year.This blogpost explores the technique used by Paylogic, the payment provider for the Tomorrowland tickets, to sell the tickets in a scalable way.It also shows how this system can be scripted/abused to increase your chance of buying tickets. So how does the normal process for getting tickets look? There are 3 steps:Preregistering before the event gives us a unique link that can be used to buy tickets.The link looks something like this:The interesting part here is the #pld which follows the link, which is unique for every person. Because this part follows after the # sign, it is not sent to the server when the page is requested.It is thus safe to say that the server does not check the pld link provided. When we look at the javascript on the page, we can see that the information is decoded and processed by the script. Because of the characters used, it is easy to spot that the data is base64 encoded.The javascript on the page (at least the Belgian sale page) in turn loads a library used for compressing and decompressing data. So we assume that the data is compressed and base64 encoded. Lets see what a little python does with it:This gives the following result:Ah, so the personal data is just a JSON object with the information that you entered at registration. It is also possible to change the JSON, use that in the URL and still enter the sale. In fact, it is also possible to buy tickets for different events with this same snippet.The data is just passed through to the Paylogic store website, after which it will be used to pre-fill your data when purchasing tickets. The event does not matter, since the same sale system is used. This also suggest that preregistration is maybe not even required to get a ticket.On the day of the sale itself you can visit the sale page with the unique link, which will put you in the queue around the event start time. Because of the ticket demand, there are a lot of myths on the internet from what you should do to maximize your chance.Note that the information here is the result of my personal analysis of the Paylogic queue system, and is partly based on observations and reading (obfuscated) javascript, meaning that some things may not be 100% correct.The queue system itself is quite simple. Lets look at the URL itself (which gets loaded via an iframe on the landing page) first:We see the same Google Analytics ID as we saw in the previous URL. This is used by Paylogic to see how well their system performs.The other two interesting variables are the two numbers in the URL, 115642 and 2993. The 115642 is the event ID for which you will be queuing up. Both the Belgian, worldwide presale and the worldwide regular sale had different event IDs.The second number, 2993, seems to be the same for all events and across years, indicating it is probably a merchant ID for the Tomorrowland organization (Paylogic calls it the point_of_sale_id).Once on the page, the queue system is handled via Javascript, doing regular AJAX requests to the Paylogic Queue API. The URL for this API isHere we see the same IDs that were used previously, for the event ID and point_of_sale ID.The queue API is used to handle the thousands of people trying to get tickets at the same time, which is probably why Paylogic tried to keep it as simple as possible.Upon loading the page, your browser will set a timer with a random time before it will contact the API server. Once the event starts, this API server will start handing out tokens. Lets call this server the "token server".A request to the token server occurs via AJAX, to for example the following URL:We see once again the two sale IDs, and an added timestamp to prevent the browser from caching the request.The result of this is the following JSON:We see several variables here, the fist one being the content, which contains relevant content to fill in the templates on the site and announcements regarding the sale.For our purpose, this variable is not really interesting. The following variables, start_date, redirect, refresh_seconds and token, are much more interesting.The token is your queue ticket. In the example above it is not present because at this point the tickets were already sold out. During the sale, the token looks something like this:We see several strings and numbers, separated by plus signs. Once again we see the sale IDs, some numbers and some strings, one 32 characters long (maybe a hash?), and one seemingly base64 encoded.The numbers are the most interesting in the token. The 1486227779 and 1486227853 are UNIX timestamps (measured in seconds since 1 Jan 1970), the first one is from 2017-02-04 18:02:59 CET, while the second one is from 18:04:13.My guess is that these timestamps indicate the time that the token is valid. Since this time is pretty short, your browser performs a new API request after the number of seconds indicated by the refresh_seconds variable discussed earlier, to update the token.I haven't figured out what the number 66 stands for, but I've found the number 81672 in this token to be increasing when new tokens are requested during the sale. This number most likely represents your position in the queue, which in this case is 81672. Lastly, the base64 encoded string does not appear to decode to readable text. I'm guessing its a HMAC used to sign the token, so that the server can verify it hasn't been changed.One thing to note here is that the personal information is never sent to the server during the queuing time (and is thus not verified or required to get a token).Your browser will store the token in a cookie, and will send this cookie in the next request (both as cookie and as part of the URL). After every request, you get a new token, with a new refresh time, while your position in the queue remains the same (you can't see how many people are in front of you still, you can just see what your absolute position in the queue since the start is).Once it is your turn to buy tickets, the "redirect" variable will be set, which contains a URL to https://frontoffice.paylogic.nl , which is the main Paylogic ticket site, where you can choose your tickets and pay for them.The url looks like this:We see once again the token (with all the special characters encoded), though now the number 0 before the 11564 is changed to a 1, which could indicate that we are now authorized to buy tickets. At the end we see the same Paylogic data as previously, the first time our personal data is sent to the server.Now we understand how the system works, we also understand how it can be abused. What I haven't mentioned yet, are a few rules that apply to the token server:Because of how the system works, there are several ways that can abuse the ticket system:Note that refreshing the browser page at a fixed time will not work, since both the start of the sale and the time your browser will take to request its first ticket are random (the sale does not start exactly at the time they say it does, and a few seconds makes all the difference).As a proof of concept, I've developed a simple python script that will do the following:This approach seems to work fairly well. During the international sale, I was able to get a link to the ticket shop using this approach, with only 10 threads that would request tokens. I didn't actually buy any tickets, the point was to prove it is possible.With more threads, during the presale (during which I think more tickets were available), or as a Belgian person during the Belgian sale, I imagine that it would be not that hard to purchase any type of tickets you could want.Obtaining a token:Getting through the queue:The ticket shop:With the current system that Paylogic uses it is not too complex to script the queue system and abuse this to buy tickets in an automated way. I imagine resellers have been doing this already for a couple of years (I haven't noticed any significant changes in the way the API operates since the Tomorrowland sale in 2015).The best way to prevent this would be encrypting the entire token payload, so that the queue position cannot be read or automated by anyone that attempts to abuse the system.This together with the queue position 0 should prevent most automated attacks and make the sale (more) fair for everyone. Of course this would not prevent people from just opening more browser windows.IP restrictions and request rate limiting (for as far as this is not yet in place) may help preventing these attacks. Another option is enforcing the checks of the preregistration data. While it is against the official rules to use the same shop link multiple times, this does not seem to be technically enforced in any way (the personal data is not even sent to the server before you have the chance to buy tickets).