How we hacked SAP

Jan Zatloukal


My blog is no longer maintenance. I am writing articles about testing on Testujeme.software (in Czech).

articles in the archive

One of our clients has started using SAP to manage processes in the company and they wanted to create an e-shop connected to it also.

We had no experience with SAP but we "just" did a complete design of the e-shop (including today's fashionable UX/UI) and I coded the templates.

The company that implemented SAP was in charge of the creation itself - they had experience with it and owned solution e-commerce, but...

...even after half a year, the e-shop was not ready. The essential functions of the e-shop did not work. I had to modify the templates because "the component generates HTML differently and we can!t change it". The only thing that somehow worked was the catalog.

Both the client and us were running out of patience, and relations with the implementation company were getting worse and worse, so we decided to try to build the e-shop ourselves.

That SAP will probably not be such a problem...

Of course, we could not contact the implementation company to give us any documentation or access. Everything was up to us.

Guerrilla action

The basic premise was to somehow get the data from SAP. We prepared a dedicated computer that we delivered to the client's office and connected it to the local network. We used it as a secure SSH tunnel so we got access to their network.

All that remained was to get access to SAP's database.

We knew the IP address of the server and login name as well. Only the password was missing because they used the stored one and can't find what it was.

What no one expected. A colleague copied the asterisks "*" from the SAP login window and pasted them into a notepad.

And we had a password.

Not bullshitting. This really happened.

So we created a new user with read-only rights (so we can't screw anything). After that, we discovered there are some issues with connectivity due to restrictions on the internet provider side. So we call them and described our situation. They had no idea how to solve it, so my colleague showed them :-)

Database hell

The next part was completely on my side. My task was to find connections in the mess of tables and create SQL (MSSQL) queries to get all data we needed.

As I said before – there was no one to ask, no documentation, just nothing. The tables had strange names, there was no structure, damn it.

It took me a few days, but I finally solved this and found all possible (and impossible) connections between the data.

The system of order numbers was interesting, for example. There were about 4 tables. The position of the parameter in the order number was stored in the first table, its value in another one, the group of parameters in another one, ... and so on.

Finally, I created a four-page document full of SQL queries and described how it works so we were able to start working on importing products into our e-shop.

It works

In the beginning, a lot of things still needed to be fine-tuned, but the e-shop has been operating for several years.

The mission was successful.

We still only have read-only access to SAP, so there is only one-way connection (from SAP to the e-shop). If we were to create orders, we probably wouldn't be able to do this without the assistance of an implementation company, for example. But that should be another story.