Skip to content
IDOR Write-up Intermediate

IRCTC — Millions of Passenger Details left at huge risk!

Two APIs lacked rate limiting, allowing an attacker to brute-force PNR numbers to obtain transaction IDs and then retrieve passenger details including names, ages, and insurance nominee information. The attacker could access about 1,000 passenger records in 10 minutes.

Avinash Jain Follow

Published on medium.com

#### Avinash Jain (@logicbomb1)

Avinash Jain (@logicbomb_1), on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

IRCTC is India's largest online ticketing operation, and the report describes it as running one of the largest e-commerce sites, with around 3 crores registered users and around 5,50,000 to 6,00,000 bookings every day, generating revenue of Rs 1,506 crore yearly (the author cites Wiki for these figures).

In 2016 IRCTC introduced free accidental insurance cover for all tickets booked online. When a passenger books a ticket, IRCTC shares passenger and journey details with a third-party insurer. Once the ticket is confirmed, IRCTC generates a premium number with one of three insurance vendors. When the passenger clicks the premium link, they are redirected to the third-party insurer's web portal, where they can view and update nominee details.

The write-up was produced together with Gurunath, with the stated aim of moving focus towards government sites to help secure them and raise security awareness in government sectors.

Setup

The report does not describe any accounts, roles, tooling or versions. The only precondition it makes explicit is the normal booking flow: a confirmed ticket produces a premium link to the insurer portal, and that link carries a transaction number.

Finding it

When a user clicks the premium link, they are redirected to a URL of this shape:

All the passenger information is retrieved on the basis of that transaction number (TXNId). The transaction number itself is hard to guess, so the interesting question was where it comes from. By further inspection, the researchers were able to modify a request to supply a PNR number as input and receive the transaction number as the response.

Image for post
API response showing transaction ID of passenger from PNR number From the original on medium.com

The screenshot shows the API response returning the transaction ID of a passenger from a PNR number.

That changes the problem completely. The PNR number is a 10 digit number which follows a sequence, with the first three digits constant for a given zone. So all it requires is to brute force, that is change, the remaining seven digits to get all valid transaction numbers.

Exploitation

Step 1: turn a PNR into a transaction number

The first API accepts a PNR number and returns the corresponding transaction number. Because the first three digits of a PNR are fixed per zone, only the remaining seven digits need to be varied to enumerate valid combinations.

Step 2: turn a transaction number into passenger data

After getting a valid combination of PNR number and transaction number, all it took was to send this information to another API, which is also not protected by any rate limiting: it can be hit as many times as wanted with no blocking. The result is that details of any passenger can be fetched.

Image for post
Passenger Information received as response From the original on medium.com

The response shown here is the passenger information returned by the second API.

Image for post
Passenger Detail From the original on medium.com

A single passenger's detail as returned by the API.

Step 3: scale it

Because neither API enforces rate limiting, the two steps can be chained at volume. Within 10 minutes the researchers were able to read almost 1000 passenger records.

Image for post
1000 Passenger details in less than 10mins From the original on medium.com

The screenshot shows 1000 passenger details collected in less than 10 minutes.

Image for post
Passenger Detail From the original on medium.com

Another view of an individual passenger detail.

A further passenger detail record.

Image for post
Some list of Passenger Details From the original on medium.com

A list of passenger details as collected during the run.

Root cause

The design exposes two APIs that together form a complete lookup chain from a guessable identifier to personal data:

  1. The first API maps a PNR number to the transaction number used by the insurer portal. The PNR is not a secret: it is a 10 digit sequence whose first three digits are constant for a zone, leaving seven digits to enumerate.
  2. The second API maps the transaction number to the full passenger record, and neither endpoint applies rate limiting, so enumeration is neither slowed nor blocked.

The transaction number on its own was hard to guess. The weakness is that a second, unprotected endpoint hands that transaction number out for an identifier that is cheap to enumerate. The report does not describe any control on either API beyond the identifiers themselves.

Impact

Since both APIs are not protected by any rate limiting, passenger information is accessible without any proper protection mechanism. The data includes the passenger's full name, age, gender and journey details, and even the insurance nominee details: name, mobile number and age.

Within 10 minutes the researchers read almost 1000 passenger records. With more than half a million tickets (5,00,000 to 6,00,000) booked through IRCTC daily, the report argues an attacker could target about 1/3 of all passenger details per day.

The author notes that IRCTC introduced free accidental insurance in 2016, so the vulnerability might have existed since then, with passenger details leaking for the past two years.

Fix

The report states that the vulnerability was reported to CERT-In and the IRCTC team, and that a response on Aug 29 said the issue was fixed. The report's own recommendations for protecting user data are:

  1. Every government website storing user data should have a dedicated security team.
  2. Regular testing of such applications, either outsourced to external vendors or done internally.
  3. A bug bounty programme or responsible disclosure policy should be implemented as soon as possible.
  4. A firewall does not mean the application is completely protected; a security team needs to maintain and review the security of the applications.
  5. Appropriate reward and appreciation should be given to ethical hackers who report vulnerabilities.

Timeline

  • Discovered issue: Aug 13, 11:30 PM
  • Reported to CERT-In and IRCTC: Aug 14, 12:30 AM

The first reach out to the IRCTC and CERT teams.

  • Acknowledgment from CERT: Aug 14, 4:30 AM
  • Response received that the issue was fixed: Aug 29, 11:02 AM
  • Verified and notified CERT about public disclosure: Aug 29, 9:58 PM
Image for post
Notified CERT team for public disclosure From the original on medium.com

The notification to the CERT team about public disclosure.

Variants to test

  • Identifier-to-secret lookup endpoints. Look for any API that accepts a user-supplied identifier (booking reference, order number, PNR, invoice number) and returns an internal token or reference used elsewhere. A positive result is a response containing a transaction or session identifier that the client never legitimately needed.
  • Sequential or partially fixed identifiers. Where an identifier has a constant prefix per zone, region or tenant, vary only the remaining digits and watch for valid responses. A positive result is a run of successful lookups at a rate the server does not throttle.
  • Rate limiting on both legs of a chain. Test each endpoint separately with a burst of requests. A positive result is no blocking, delay or CAPTCHA after hundreds of requests, especially on the endpoint that returns personal data.
  • Third-party redirect parameters. Check insurer, payment and partner redirect URLs for parameters such as transaction IDs that are accepted without binding to the logged-in user. A positive result is retrieving another user's record by supplying only the parameter.
  • Nominee and profile update pages. Where a redirect lands on a page that can view and update nominee details, test whether the same parameter grants write access. A positive result is a change persisted on a record that does not belong to the tester.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

What happened, in plain words

IRCTC is India's largest online ticketing operation. The report describes it as running one of the largest e-commerce sites, with around 3 crores registered users and around 5,50,000 to 6,00,000 bookings every day, generating revenue of Rs 1,506 crore yearly (the author cites Wiki for these figures).

In 2016 IRCTC introduced free accidental insurance cover for all tickets booked online. When you book a ticket, IRCTC passes your passenger and journey details to a third-party insurer. Once the ticket is confirmed, IRCTC generates a premium number with one of three insurance vendors. When you click the premium link, you are redirected to the third-party insurer's web portal, where you can view and update your nominee details.

The write-up was produced together with Gurunath, with the stated aim of moving focus towards government sites to help secure them and raise security awareness in government sectors.

What the researchers found is that the insurer's portal decided who you were from a single number in the web address, the transaction number. That number was hard to guess on its own, so it looked like a reasonable protection. But a second service, an API, would hand out the transaction number to anyone who asked with a PNR number, and a PNR number is not a secret at all: it is a 10 digit number whose first three digits are fixed for a zone, leaving only seven digits to try. Neither service limited how many times you could ask. So the two together let anyone walk from a guessable booking reference to a passenger's full name, age, gender, journey details and even their insurance nominee's name, mobile number and age. In 10 minutes the researchers read almost 1000 passenger records.

The background you need first

A few ideas come up again and again below, so here they are from zero.

What an API is. Think of a restaurant. The menu and the dining room are the website you see; the kitchen is the database where the real information lives. An API is the waiter: a fixed way for one piece of software to ask another for something specific and get an answer back, without either side knowing how the other works inside. When a web page needs data, it often asks an API behind the scenes, and the API replies with a structured answer rather than a pretty page.

What a request and a response are. Your browser sends a request ("give me this page", "here is a number, tell me what it belongs to") and the server sends back a response (the page, or the data, or an error). Every step in this report is one request and one response.

What a parameter is. A parameter is a named value attached to a request, the part after the question mark in a web address. In ?TXNId=10000139XXXXXX, the parameter is called TXNId and its value is the transaction number. Parameters are how you tell a service which record you mean.

What a PNR number is. PNR stands for Passenger Name Record. It is the booking reference printed on your ticket, the short code you quote when you call about a journey. It identifies a booking, not a person, and it is not treated as a secret: it appears on tickets and in emails.

What a transaction number is. Here it is a reference the insurer uses to look up one passenger's insurance record. The report calls it hard to guess, which is why the nominee page relied on it.

What brute forcing is. Brute forcing means trying values one after another instead of being clever: 0000001, 0000002, 0000003 and so on. It only works when the space of possible values is small enough to walk through, and when nothing stops you from trying.

What rate limiting is. Rate limiting is a server saying "you may ask 10 times a minute, not 10,000". It is the bouncer at the door counting how many people you bring in. Without it, a script can ask as fast as the network allows.

What information disclosure means. Information disclosure is the vulnerability class here: data that should only be visible to its owner becomes visible to someone who should not have it. Nothing is broken or crashed; the data is simply handed out too freely.

Setting the scene

The report does not describe any accounts, roles, tooling or versions. The only precondition it makes explicit is the normal booking flow: a confirmed ticket produces a premium link to the insurer portal, and that link carries a transaction number.

Finding it

When a user clicks the premium link, they are redirected to a URL of this shape:

Line by line: https:// is the secure web protocol; www.shriramgi.com is the insurer's site; /irctc-nominee.html is the page for viewing and updating nominee details; and everything after the ? is the parameter, TXNId, whose value is the transaction number. The XXXXXX at the end stands for digits the report does not show.

All the passenger information is retrieved on the basis of that transaction number. In other words, the page retrieves the passenger information based on the number in the address.

The transaction number itself is hard to guess, so the interesting question was where it comes from. If you cannot guess it, can you get someone to tell it to you? By further inspection, the researchers were able to modify a request to supply a PNR number as input and receive the transaction number as the response.

Image for post
API response showing transaction ID of passenger from PNR number From the original on medium.com

The screenshot shows the API response returning the transaction ID of a passenger from a PNR number. In plain terms: they sent a booking reference to one service and it answered with the reference the insurer's page uses.

That changes the problem completely. The PNR number is a 10 digit number which follows a sequence, with the first three digits constant for a given zone. So all it requires is to brute force, that is change, the remaining seven digits to get all valid transaction numbers.

Why does that matter so much? Because a secret is only as strong as the easiest way to obtain it. The transaction number was protected by being unguessable, but the PNR is guessable, and one service happily converts the guessable thing into the unguessable thing. The lock is strong; the key is lying on the table.

Exploitation

Step 1: turn a PNR into a transaction number

The first API accepts a PNR number and returns the corresponding transaction number. Because the first three digits of a PNR are fixed per zone, only the remaining seven digits need to be varied to enumerate valid combinations.

Enumerating means walking through possibilities systematically rather than randomly. Seven digits is ten million combinations, which sounds like a lot until you remember a script can send requests far faster than a person can type.

Step 2: turn a transaction number into passenger data

After getting a valid combination of PNR number and transaction number, all it took was to send this information to another API, which is also not protected by any rate limiting: it can be hit as many times as wanted with no blocking. The result is that details of any passenger can be fetched.

This is the second leg of the chain. The first service gave out the key; the second service opened the door with it, and it had no bouncer counting requests. Two unprotected services in a row turn a single guessable number into a full personal record.

Image for post
Passenger Information received as response From the original on medium.com

The response shown here is the passenger information returned by the second API.

Image for post
Passenger Detail From the original on medium.com

A single passenger's detail as returned by the API.

Step 3: scale it

Because neither API enforces rate limiting, the two steps can be chained at volume. Within 10 minutes the researchers were able to read almost 1000 passenger records.

Chaining means feeding the output of one step into the next automatically: PNR in, transaction number out, transaction number in, passenger record out, repeat. The only limit is how fast requests can be sent, and there was no limit.

Image for post
1000 Passenger details in less than 10mins From the original on medium.com

The screenshot shows 1000 passenger details collected in less than 10 minutes.

Image for post
Passenger Detail From the original on medium.com

Another view of an individual passenger detail.

A further passenger detail record.

Image for post
Some list of Passenger Details From the original on medium.com

A list of passenger details as collected during the run.

Root cause

The design exposes two APIs that together form a complete lookup chain from a guessable identifier to personal data:

  1. The first API maps a PNR number to the transaction number used by the insurer portal. The PNR is not a secret: it is a 10 digit sequence whose first three digits are constant for a zone, leaving seven digits to enumerate.
  2. The second API maps the transaction number to the full passenger record, and neither endpoint applies rate limiting, so enumeration is neither slowed nor blocked.

The transaction number on its own was hard to guess, which is presumably why it was treated as sufficient protection for the nominee page. The weakness is that a second, unprotected endpoint hands that transaction number out for an identifier that is cheap to enumerate.

A useful way to hold this in your head: security by obscurity means relying on something being hard to find or guess. It is not worthless, but it collapses the moment someone finds a side door that gives the secret away. Here the side door was the first API.

Impact

Since both APIs are not protected by any rate limiting, passenger information is accessible without any proper protection mechanism. The data includes the passenger's full name, age, gender and journey details, and even the insurance nominee details: name, mobile number and age.

Within 10 minutes the researchers read almost 1000 passenger records. With more than half a million tickets (5,00,000 to 6,00,000) booked through IRCTC daily, the report argues an attacker could target about 1/3 of all passenger details per day.

The author notes that IRCTC introduced free accidental insurance in 2016, so the vulnerability might have existed since then, with passenger details leaking for the past two years.

None of this requires breaking encryption; it is simply asking the right service the right question.

Fix

The report states that the vulnerability was reported to CERT-In and the IRCTC team, and that a response on Aug 29 said the issue was fixed. The report's own recommendations for protecting user data are:

  1. Every government website storing user data should have a dedicated security team.
  2. Regular testing of such applications, either outsourced to external vendors or done internally.
  3. A bug bounty programme or responsible disclosure policy should be implemented as soon as possible.
  4. A firewall does not mean the application is completely protected; a security team needs to maintain and review the security of the applications.
  5. Appropriate reward and appreciation should be given to ethical hackers who report vulnerabilities.

A bug bounty programme is a published offer: find a flaw, report it privately, get a reward. A responsible disclosure policy is the promise that reports will be handled and fixed rather than ignored or punished. Both exist to make the honest path easier than the dishonest one.

Timeline

  • Discovered issue: Aug 13, 11:30 PM
  • Reported to CERT-In and IRCTC: Aug 14, 12:30 AM

The first reach out to the IRCTC and CERT teams.

  • Acknowledgment from CERT: Aug 14, 4:30 AM
  • Response received that the issue was fixed: Aug 29, 11:02 AM
  • Verified and notified CERT about public disclosure: Aug 29, 9:58 PM
Image for post
Notified CERT team for public disclosure From the original on medium.com

The notification to the CERT team about public disclosure.

CERT-In is India's national computer emergency response team, the body that coordinates reports about security problems in Indian systems. Telling them, and then telling them again before publishing, is the standard courtesy that keeps disclosure responsible.

Variants to test

If you are learning from this, these are the patterns worth recognising in other applications. Each one is described as a thing to look for and the sign that you have found it.

  • Identifier-to-secret lookup endpoints. Look for any API that accepts a user-supplied identifier (booking reference, order number, PNR, invoice number) and returns an internal token or reference used elsewhere. A positive result is a response containing a transaction or session identifier that the client never legitimately needed.
  • Sequential or partially fixed identifiers. Where an identifier has a constant prefix per zone, region or tenant, vary only the remaining digits and watch for valid responses. A positive result is a run of successful lookups at a rate the server does not throttle.
  • Rate limiting on both legs of a chain. Test each endpoint separately with a burst of requests. A positive result is no blocking, delay or CAPTCHA after hundreds of requests, especially on the endpoint that returns personal data.
  • Third-party redirect parameters. Check insurer, payment and partner redirect URLs for parameters such as transaction IDs that are accepted without binding to the logged-in user. A positive result is retrieving another user's record by supplying only the parameter.
  • Nominee and profile update pages. Where a redirect lands on a page that can view and update nominee details, test whether the same parameter grants write access. A positive result is a change persisted on a record that does not belong to the tester.

Glossary

  • API: a fixed way for one piece of software to ask another for specific data and get a structured answer back.
  • Brute force: trying values one after another, systematically, instead of guessing cleverly.
  • Bug bounty programme: a published offer to reward people who find and privately report security flaws.
  • CERT-In: India's national computer emergency response team, which coordinates reports of security problems.
  • Chaining: feeding the output of one request into the next so steps run automatically in sequence.
  • Enumerate: to walk through a set of possible values systematically to find the valid ones.
  • Information disclosure: a vulnerability where data that should be private is handed to someone who should not see it.
  • Parameter: a named value attached to a request, usually after the question mark in a web address.
  • PNR (Passenger Name Record): the booking reference for a journey, printed on tickets and not treated as a secret.
  • Rate limiting: a server-side limit on how many requests a client may make in a given time.
  • Request / response: the message your browser or script sends to a server, and the message the server sends back.
  • Responsible disclosure policy: a published promise describing how security reports will be received, handled and fixed.
  • Security by obscurity: relying on something being hard to find or guess as its protection.
  • Transaction number (TXNId): the reference the insurer's portal uses to look up one passenger's insurance record.
  • Vulnerability class: a family of related weaknesses that share the same underlying mistake.

More by Avinash Jain

View all

29 more disclosed reports, best first.

More from IRCTC

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.