Reverse Engineering Cathay Pacific’s Seat Selection Page
Tags: web
Published: 2018-11-01 06:52:41

---
title: Reverse Engineering Cathay Pacific’s Seat Selection Page
published: true
description: Learn how I reverse engineer the Cathay Pacific's seat selection page.
tags: web
cover_image: https://thepracticaldev.s3.amazonaws.com/i/n44k1wnod9n3r71wgv9e.png
---

_This post was originally published on [medium.com](https://medium.com/@limhenry/reverse-engineering-cathay-pacifics-seat-selection-page-89f4d10dd9e8)._

> _**Note**: I am not a security researcher, and I do not have any advance web security knowledge, etc._

> _Also, I **did not alter any data** on the Cathay Pacific’s website and I didn't manage to use this method to change my seat. In addition, you can't get any personal data using the method I mentioned in this article._

> _**However, I was able to view all seat maps for all Cathay Pacific’s flight.**_

> _Also, this is not something new. You actually can do the same thing using this website: www.expertflyer.com._

> _**Cathay Pacific, if you are reading this, [please DM me on Twitter](https://twitter.com/messages/compose?recipient_id=2360382986).**_


### Storytime!

I love flying, and I absolutely love window seat (_Yes, Boeing 787’s window is amazing! It’s super big and the window dimming is just like magic_).

So here’s the story. I am flying Cathay Pacific to San Francisco in the upcoming week (_Hooray!_). Unfortunately, my ticket fare type is Class S (Economy Save), which is not eligible for advance seat request :(

![](https://i.imgur.com/F4uzE0l.png])
![](https://i.imgur.com/svZLJhM.png)

### I want a window seat!!!

Maybe I can check is there any window seats left? So I went to the Cathay Pacific’s website and entered my booking reference. Then I clicked on the “Select seat” button, and this is what I saw:

![](https://i.imgur.com/Cp9chS2.png)
*Nope nope nope nope nope.*

### All the seats are not available?
Bummer, it looks like website won’t show you the seat availability if you are not eligible for advance seat request. That’s sad for me. What should I do now?

### Hello, Chrome DevTools

Well, what else I can do? Of course, I can just open the Chrome DevTools and find is there any hidden information.

So I clicked on the “Network” tab and search for the HTTP request for the seat map. Voila! This is what I found:

![](https://i.imgur.com/YvpiDjo.png)
_JSON result of the seat map_
![](https://i.imgur.com/uq0K5xm.png)
_API URL for the seat map (Some personal data are hidden)_

This is the part that makes everything interesting. What if I change the `bookingClass` from `S` (Economy Save, not eligible for seat request), to `L` (Economy Standard, eligible for seat request)?

So I open a new Chrome tab, edit the parameter, paste the URL, and hit enter!

### No. Error. Message.

![](https://cdn-images-1.medium.com/max/1600/1*l8-zA0uI4PmrkGQ8FC9UUA.png)

It returns the full seat map. But this time, the JSON result is slightly different.

For the first time, I can see there are some seats which are still available.

I am now looking at the unformatted JSON result right now, which is _ugly_. I need a proper visual for this. So I open my code editor and paste the JSON result (_I can’t do the HTTP request directly to the Cathay Pacific’s server due to CORS access restrictions_).

With a little bit help of CSS and JavaScript, finally this is something I want to see:

![](https://i.imgur.com/VwjpDZ2.png)


Mission accomplished! You can check out the demo here: [https://button-dew.glitch.me](https://button-dew.glitch.me), ([Source](https://glitch.com/edit/#!/button-dew)).

### Extra: How secure is the API?

![](https://i.imgur.com/J3ej3b4.png)

For some reason, `currency`, `familyName`, `givenName`, `passengerId`, and `passengerType` are not required.

As long you have the `rloc` (Booking Reference Code) and the correct flight info, you will able to get the seat map. No family name and given name required!

Let’s do some quick math. Since the booking reference code is a combination of 6 digits letters and numbers, so the code combination for this is 2,176,782,336, and the total seats for the [Boeing 777–300ER economy class are 268 seats](https://www.seatguru.com/airlines/Cathay_Pacific_Airways/Cathay_Pacific_Airways_Boeing_777-300ER_C.php).

Hence, the chance for you to guess the correct booking reference code is 0.000012311750034340594%.

_I guess this is quite secure?_

---

### [Update: 2 Nov 2018] Well, I was wrong. This is not secure.

![](https://cdn-images-1.medium.com/max/800/1*GGDZ3DjkigxYEi3QeLZctg.png)

Nope. This is not good at all.

As long you have the valid booking reference (`rloc`), you will able to get **THE FULL SEAT MAP FOR ALL CATHAY PACIFIC FLIGHTS**.

_The screenshot above is the business class seat map from Hong Kong to Beijing (CX5900). And of course, I am not flying on that flight._

---

**DO SOMETHING, CATHAY PACIFIC!**

---

![](https://cdn-images-1.medium.com/max/800/1*QFhn3NEZJcPvaxqISNUoMg.png)
_And this is what they told me …_

---

Whether I get the window seat or not, I am flying to San Francisco to attend my very first [Chrome Dev Summit](https://developer.chrome.com/devsummit/) in the upcoming week!

_(If you are joining the event)_ See you in two weeks! Woot woot!

---

![](https://i.imgur.com/uPNmpFy.jpg)
_But no. I don’t want to see you, Karl. (That’s the Golden Gate Bridge hiding behind the thick fog). — May 2017_