Tuesday, May 19, 2020

Hacking PayPal's Express Checkout



Do you know what is happening in the background when you buy something in an online shop using PayPal?

In this post we will tackle the following problems:
  • How can PayPal's API be tested?
  • How does PayPal's Express Checkout work? You can find the detailed report here.
  • How can we debit more money than authorized?

How PayPal's API can be tested?

PayPal's Sandbox API

PayPal offers a feature called PayPal Sandbox Accounts, which mimics the production API. The basic idea is that a normal user/shop can test the API and make transactions without actually transferring money. This is the perfect tool for developers to test their API integration.

Access to all messages

The next question is how to get access to all messages. All browser-related messages can be inspected, intercepted, and modified via BurpSuite. The main problem here is how to get access to the server-to-server exchanged messages: the messages exchanged between PayPal and a shop. In order to solve this problem, we deployed our own shop. For this purpose we used Magento, which already has a PayPal integration.
Once we have our own controlled shop, we can enforce Magento to send all request through a proxy.
In the following picture you can see our setup.

Test suite for analyzing PayPal's API [1]

In order to capture the traffic between our Magento hhop and PayPal we proceeded as follows:
  • We configured Magento to use a proxy running on localhost:8081.
  • We connected the proxy port on the virtual machine with our local machine via SSH remote port forwarding by issuing the following command
    ssh -N -R 8081: localhost :8081 <IP of Magento shop>
  • We configured BurpSuite running on our local machine to listen on Port 8081 for incoming requests.
Now, we were able to see the entire traffic.
Please note that we uses our own, custom Magento shop in order to be able to test Paypal's API.

PayPal's Express Checkout

An overview of the checkout procedure is depicted in the following:

PayPal's Express Checkout [2]




Step 1: Magento tells the PayPal API where to redirect the user after authorizing the transaction via the parameter RETURNURL and requests a token for this transaction.
Step 2: The PayPal API provides Magento with the token.
Step 3: Magento redirects the user to PayPal's website. The redirect contains the token from the previous step.
Step 4:  The user authorizes the transaction. As a result, he will be redirected back to Magento (RETURNURL) with the token.
Step 5: Magento issues a request to the PayPal API to get the transaction details.

Step 6: Magento signals the PayPal API to execute the transaction.

Step 7: Magento serves the success page.

A more detailed view of the protocol and all parameters is shown on page 16 in the full version. We will concentrate only on step 6 and the parameters relevant for the attack.

The Attack

The goal of the attack is to let a shop (in our case Magento) debit more money than authorized by the PayPal user. The core of the attack is Step 6 -- DoExpressCheckoutPayment. Let's get a deeper look at this message:

Magento can raise the authorized amount and debit more money from the user's account

  • The shop sends the token, which was issued in the first step of the protocol and identifies uniquely the transaction through all steps. 
  • The PayerID referring to the user that authorized the payment.
  • The AMT defining the amount, which will be transferred.
  • The API Credentials authenticating Magento on PayPal.
  • The Version pointing to the release number of the API.

As one can imagine, the core problem we found was the change of the AMT parameter. This value can be freely chosen by the shop, despite the fact that the user has authorized a different amount.

We tested only the SandBox API, but refused to test the production API in order to avoid problems. We promptly contacted PayPal's security team and described the problem hoping that PayPal can and will test the production API against the attack.

The response of PayPal can be summarized as follows:
  • We don't get any BugBounty since we only tested the Sanbox API. (Fair enough)
  • In the Production API PayPal this flexibility is a wanted feature. Thus, PayPal allows a merchant to charge for shipping and/or other expenses different amounts. Any malicious behavior can be detected by PayPal. In case of fraudulent charges the consumer are protected by the Buyer Protection policy.
... but the Sandbox API was nevertheless fixed.

Authors of this Post

Daniel Hirschberger
Vladislav Mladenov
Christian Mainka (@CheariX)



[1] BurpSuite Logo
[2] PayPal Express Checkout

Read more


  1. Herramientas Hacking
  2. Aprender Hacking Desde Cero
  3. Hacking Food
  4. Un Hacker
  5. Hacking Apps
  6. Tools For Hacking Wifi
  7. Hacking Tor Funciona

El Cuento De "La Princesita De Ocho Piernas"

Hoy, cuando me he sentado a escribir el post diario de El lado del mal no quería ponerme a escribir de algo profesional. Tengo tres artículos rondando mi cabeza sobre temas técnicos y profesionales, pero hoy no me apetecía depurarlos y plasmarlos. Hoy hace sol, y quería dejar que el calor me bañara un poco. Quería dejar que el calorcito sacar algo más humano para el texto del día. 

Figura 1: El cuento de "La princesita de ocho piernas"


Así que, os he traído uno de los cuentos que narro a Mi Hacker y Mi Survivor cuando el tiempo me lo permite. Como todo buen papaéte estoy sufriendo la pre-adolescencia de una niña, y si no la controlas, sus peticiones son infinitas. Me piden de todo y me compran - y hackean - con dibujos, manualidades, etcétera. Pero no las puedo dar todo lo que quieren.

View this post on Instagram

... y así me hackean mis salvajes }:)

A post shared by Chema Alonso (@chemaalonso) on


No les puedo dar todo lo que quieren para que aprendan a priorizar y discernir entre lo que es necesario y lo que es accesorio. Entre la necesidad y el capricho, así que aprovechando a los personajes del Dragón Matías, el Rey Papá, Princesita, Chiquitina, Rapidín, Serpentina, etcétera, les creé este cuento "de mi boca" que os dejo hoy por aquí.

La Princesita de Ocho Piernas

Érase una vez que se era, una princesita muy presumida a la que su padre, el Rey Papá, cuidaba con mucho esmero y detalle. La Princesita era una niña estudiosa y trabajadora, aunque con algún arrebato de rabieta propio de su efervescencia debido a su edad. Con casi doce años estaba a punto de convertirse en una preciosa adolescente, y de vez en cuando – y solo de vez en cuando –, la energía que atesoraba le jugaba una mala pasada en su comportamiento. 

No era nada grave, pero os voy a narrar la aventura que sucedió cuando el Dragón Matías, amigo personal del Rey Papá, se enfadó con Princesita y le impuso un curioso castigo.

Todo comenzó cuando la dulce princesita se acercó con sus grandes ojos color miel y le dijo a su papaete:

- "Rey Papá, Rey Papá, ¿me comprarías unos zapatos nuevos para el vestido nuevo que me compré la semana pasada".

El Rey Papá la miró, y sorprendido la contestó:

- "Princesita mía, compramos el vestido para los zapatos nuevos que tenías, ¿cómo es que ahora quieres unos zapatos nuevos para ese mismo vestido?"

La Princesita comenzó un principio de rabieta y dijo:

- "Rey Papá, Rey Papá, es que ya no me gustan esos zapatos y quiero otros nuevos. No seas malo con tu princesita y cómprame unos nuevos".

El Rey Papá refunfuñó e intentó hacer entrar en razón a la joven Princesita, pero lo único que obtuvo como respuesta a sus razonamientos fuero llantos, rabieta y más quejas de la joven que parecía la niña más desdichada del mundo. Tras media hora de llantos y quejas de la princesita, al final el Rey Papá claudicó y prometió llevar a su hija al día siguiente a comprar unos nuevos zapatos.

Llegado ese día, apareció en la puerta del castillo del Rey Papá su amigo el Dragón Matías para irse a volar por las montañas. Hacía tiempo que no salían juntos y habían quedado para ir al lago de la montaña del norte a darse unos baños en agua cristalina. Cuando llegó feliz, el Rey Papá le dijo:

- "Perdona Dragón Matías, se me olvidó que hoy teníamos la excursión y le he prometido a la princesita que la llevaría a comprar unos zapatos nuevos. Vamos a tener que cancelar la excursión".

El Dragón Matías se quedó consternado, pero no por la cancelación repentina de la excursión, sino por la evolución que estaba siguiendo la pequeña princesita. El Dragón Matías había cuidado de ella y de su hermana "Chiquitinia" desde que nacieron y estos ataques compra compulsiva y caprichosa no le parecían nada bien.

- "Rey Papá", dijo el Dragón Matías, "Tú eres consciente de que Princesita no necesita para nada esos zapatos, y que esta siendo caprichosa, ¿Verdad? ¿No crees que deberías hablar con ella y explicarla que no debería comprarse cosas que no necesite?

El Rey Papá le dio la razón al Dragón Matías y se excusó diciendo que se había puesto muy pesada y no sabía cómo conseguir que se tranquilizara. En ese momento el Rey Papá se sintió un poco avergonzado, pero el Dragón Matías lo consoló.

- "¿Me dejas hablar con ella, Rey Papá?", dijo el Dragón Matías.

El Rey Papá accedió a la petición, y permitió que el Dragón Matías hablara con Princesita. Esta se puso muy contenta cuando vio a su amigo "Matiítas" y le dio un fuerte abrazo. Después, el Dragón Matías habló con ella:

- "Princesita, obligar al Rey Papá a que te compre cosas que no necesitas por medio de llantos, rabietas y enfados, no está bien. Tú sabes que él te quiere muchísimo y no puede verte sufrir, pero es malo para tu educación tener todo lo que quieras aunque no lo necesites"

Princesita se enfadó mucho al oír eso. No quería quedarse sin sus zapatos nuevos, así que empezó a regañar al Dragón Matías por decirle eso.

- "Además", dijo la Princesita, "Los necesitó."

El Dragón Matías la miró pensativo y dijo:

- "No, no los necesitas, pero te voy a dar una pequeña lección. A partir de ahora, tantos zapatos nuevos tendrás, tantos zapatos nuevos necesitarás".

La Princesita se enfado mucho con el Dragón Matías pero siguió con sus planes y obligó al Rey Papá, poniendo sobre la mesa la promesa que le había sacado el día anterior, que la llevara de compras a por los nuevos zapatos. Y se compró unos nuevo y muy caros.

A la mañana siguiente llegó la sorpresa. Cuando Princesita se levantó por la mañana se encontró que tenía cuatro piernas en lugar de tener dos como todas las niñas. Al principio se asustó, pero luego recordó las palabras del Dragón Matías y, en lugar de reflexionar sobre la situación, decidió retar al viejo dragón.

Se vistió con un vestido precioso y se puso cuatro zapatos. Dos en sus dos pies izquierdos y dos en sus dos pies derechos, y se fue a por el Rey Papá sonriendo y decidida a continuar demostrando al Rey Papá y al Dragón Matías quién es la que mandaba en esa situación.

- "Rey Papá, mira que bien me quedan los zapatos nuevos con mis nuevas piernas que tengo gracias al Dragón Matías. Lo que pasa es que ahora necesito quita-y-pon así que tenemos que ir a comprar ahora mismo dos pares de zapatos nuevos".

El Rey Papá no daba crédito a lo que veía, pero Princesita iba feliz con sus cuatro piernas y sus dos pares de zapatos puestos a la vez. Así que, después de superar el susto y de aguantar unos lloros, gritos y pataletas de Princesita, accedió a llevar la de compras a por dos nuevos pares de zapatos.

A la vuelta, el Dragón Matías esperaba al Rey Papá y Princesita. Cuando llegaron, la joven Princesita traía en las manos bolsas con las nuevas compras. Dos nuevos pares de zapatos recién comprados. Cuando llegó a la altura del Dragón Matías le enseñó presumidamente sus cuatro piernas con sus dos pares de zapatos puestos y las bolsas con los nuevos. El Dragón Matías sonrió y dijo:

- "Recuerda Princesita, tantos zapatos tendrás, tantos zapatos necesitarás".

Princesita puso sus zapatos nuevos en el guardarropa de su habitación, en el armario destinado para ellos, y se fue feliz a dormir con sus nuevas compras. Ir de compras le hacía muy feliz y ganar al Dragón Matías y salir con la suya más todavía.

Pero al día siguiente…

Princesita se despertó y se alarmó. Su cama estaba llena de piernas. Le habían crecido cuatro nuevas piernas por la noche y eso ya no le gustaba nada. Tenía ocho piernas y parecía una araña, y eso no le gustaba nada, así que, en pijama, se fue corriendo y llorando a ver al Rey Papá:

- "Papaete, papaete, tengo ocho piernas y parezco una araña.. . Buahhhh, Buahhh".

El Rey Papá esperaba en el salón junto a su amigo el Dragón Matías, que la miró con detenimiento y dijo:

- "Bueno, Princesita, ahora ya has visto lo malo que es hacer de un capricho una necesidad, ¿verdad? Dime una cosa, ¿prefieres tener dos piernas y necesitar solo un par de zapatos o tener cuatro pares de zapatos y necesitarlos todos?"

Princesita, llorando, dijo:

- "Buahh, Buahhh, prefiero tener dos piernas y necesitar solo un par de zapatos. Pero por favor, vuelve a hacer que sea una niña normal".

El Dragón Matías, sopló un humo desde dentro y bañó a Princesita en el calor de su aliento. Cuando el humo se fue, la niña volvió a ser una persona de solo dos piernas.

- "Vete a tu habitación, Princesita, y vístete para desayunar. Yo quiero hablar con el Rey Papá", dijo el Dragón Matías.

Princesita se fue feliz, y el Dragón Matías se quedó mirando seriamente al Rey Papá, para decirle:

- "¿Has visto Rey Papá lo que sucede si le das a una Princesita más de lo que necesita? Harás que su capricho se convierta en una necesidad y dejará de ser una niña normal. Y eso nunca la hará feliz, como has visto".

El Rey Papá se sintió fatal y se disculpó ante el Dragón Matías, por haber dejado que los caprichos de su hija dictaran sus acciones y por haber faltado a su cita del lago. Se abrazaron, y al día siguiente disfrutaron de una preciosa excursión.

Por otro lado, a partir de ese día, Princesita siempre pensó muy mucho que es lo que necesitaba realmente, no fuera a ser que le salieran cuatro brazos, dos bocas, os dos cabezas. ¿Quién se puede fiar de los caprichos?

Y colorín colorado… FIN.

Otros cuentos de mi boca:


Saludos Malignos!

Autor: Chema Alonso (Contactar con Chema Alonso)

Read more

Monday, May 18, 2020

W3AF

"W3AF is a Web Application Attack and Audit Framework. The project goal is to create a framework to find and exploit web application vulnerabilities that is easy to use and extend. This project is currently hosted at SourceForge." read more...

Related news


  1. Whatsapp Hacking
  2. Definicion De Hacker
  3. Hacking Wifi Windows
  4. Hackers Informaticos Contactar
  5. Tools For Hacking Wifi
  6. Hacking Etico 101 Pdf
  7. Hacking With Python
  8. Como Aprender A Ser Hacker
  9. Hacking In Spanish
  10. Etica Hacker

DirBuster: Brute Force Web Directories


"DirBuster is a multi threaded java application designed to brute force directories and files names on web/application servers. Often is the case now of what looks like a web server in a state of default installation is actually not, and has pages and applications hidden within. DirBuster attempts to find these. However tools of this nature are often as only good as the directory and file list they come with. A different approach was taken to generating this. The list was generated from scratch, by crawling the Internet and collecting the directory and files that are actually used by developers! DirBuster comes a total of 9 different lists (Further information can be found below), this makes DirBuster extremely effective at finding those hidden files and directories. And if that was not enough DirBuster also has the option to perform a pure brute force, which leaves the hidden directories and files nowhere to hide! If you have the time ;) " read more...

Download: https://sourceforge.net/projects/dirbuster

Related posts


How To Spoof PDF Signatures

One year ago, we received a contract as a PDF file. It was digitally signed. We looked at the document - ignoring the "certificate is not trusted" warning shown by the viewer - and asked ourselfs:

"How do PDF signatures exactly work?"

We are quite familiar with the security of message formats like XML and JSON. But nobody had an idea, how PDFs really work. So we started our research journey.

Today, we are happy to announce our results. In this blog post, we give an overview how PDF signatures work and on top, we reveal three novel attack classes for spoofing a digitally signed PDF document. We present our evaluation of 22 different PDF viewers and show 21 of them to be vulnerable. We additionally evaluated 8 online validation services and found 6 to be vulnerable.

In cooperation with the BSI-CERT, we contacted all vendors, provided proof-of-concept exploits, and helped them to fix the issues and three generic CVEs for each attack class were issued: CVE-2018-16042, CVE-2018-18688, CVE-2018-18689.


Full results are available in the master thesis of Karsten Meyer zu Selhausen, in our security report, and on our website.

Digitally Signed PDFs? Who the Hell uses this?

Maybe you asked yourself, if signed PDFs are important and who uses them.
In fact, you may have already used them.
Have you ever opened an Invoice by companies such as Amazon, Sixt, or Decathlon?
These PDFs are digitally signed and protected against modifications.
In fact, PDF signatures are widely deployed in our world. In 2000, President Bill Clinton enacted a federal law facilitating the use of electronic and digital signatures in interstate and foreign commerce by ensuring the validity and legal effect of contracts. He approved the eSign Act by digitally signing it.
Since 2014, organizations delivering public digital services in an EU member state are required to support digitally signed documents, which are even admissible as evidence in legal proceedings.
In Austria, every governmental authority digitally signs any official document [§19]. In addition, any new law is legally valid after its announcement within a digitally signed PDF.
Several countries like Brazil, Canada, the Russian Federation, and Japan also use and accept digitally signed documents.
According to Adobe Sign, the company processed 8 billion electronic and digital signatures in the 2017 alone.

Crash Course: PDF and PDF Signatures

To understand how to spoof PDF Signatures, we unfortunately need to explain the basics first. So here is a breef overview.

PDF files are ASCII files. You can use a common text editor to open them and read the source code.

PDF header. The header is the first line within a PDF and defines the interpreter version to be used. The provided example uses version PDF 1.7. 
PDF body. The body defines the content of the PDF and contains text blocks, fonts, images, and metadata regarding the file itself. The main building blocks within the body are objects. Each object starts with an object number followed by a generation number. The generation number should be incremented if additional changes are made to the object.
In the given example, the Body contains four objects: Catalog, Pages, Page, and stream. The Catalog object is the root object of the PDF file. It defines the document structure and can additionally declare access permissions. The Catalog refers to a Pages object which defines the number of the pages and a reference to each Page object (e.g., text columns). The Page object contains information how to build a single page. In the given example, it only contains a single string object "Hello World!".
Xref table. The Xref table contains information about the position (byte offset) of all PDF objects within the file.
Trailer. After a PDF file is read into memory, it is processed from the end to the beginning. By this means, the Trailer is the first processed content of a PDF file. It contains references to the Catalog and the Xref table.

How do PDF Signatures work?

PDF Signatures rely on a feature of the PDF specification called incremental saving (also known as incremental update), allowing the modification of a PDF file without changing the previous content.
 
As you can see in the figure on the left side, the original document is the same document as the one described above. By signing the document, an incremental saving is applied and the following content is added: a new Catalog, a Signature object, a new Xref table referencing the new object(s), and a new Trailer. The new Catalog extends the old one by adding a reference to the Signature object. The Signature object (5 0 obj) contains information regarding the applied cryptographic algorithms for hashing and signing the document. It additionally includes a Contents parameter containing a hex-encoded PKCS7 blob, which holds the certificates as well as the signature value created with the private key corresponding to the public key stored in the certificate. The ByteRange parameter defines which bytes of the PDF file are used as the hash input for the signature calculation and defines 2 integer tuples: 
a, b : Beginning at byte offset a, the following b bytes are used as the first input for the hash calculation. Typically, a 0 is used to indicate that the beginning of the file is used while a b is the byte offset where the PKCS#7 blob begins.
c, d : Typically, byte offset c is the end of the PKCS#7 blob, while c d points to the last byte range of the PDF file and is used as the second input to the hash calculation.
    According to the specification, it is recommended to sign the whole file except for the PKCS#7 blob (located in the range between a b and c).

    Attacks

    During our research, we discovered three novel attack classes on PDF signatures:

    1. Universal Signature Forgery (USF)
    2. Incremental Saving Attack (ISA)
    3. Signature Wrapping Attack (SWA)

    In this blog post, we give an overview on the attacks without going into technical details. If you are more interested, just take a look at the sources we summarized for you here.

    Universal Signature Forgery (USF)

    The main idea of Universal Signature Forgery (USF) is to manipulate the meta information in the signature in such a way that the targeted viewer application opens the PDF file, finds the signature, but is unable to find all necessary data for its validation.

    Instead of treating the missing information as an error, it shows that the contained signature is valid. For example, the attacker can manipulate the Contents or ByteRange values within the Signature object. The manipulation of these entries is reasoned by the fact that we either remove the signature value or the information stating which content is signed.
    The attack seems trivial, but even very good implementations like Adobe Reader DC preventing all other attacks were susceptible against USF.

    Incremental Saving Attack (ISA)



    The Incremental Saving Attack (ISA) abuses a legitimate feature of the PDF specification, which allows to update a PDF file by appending the changes. The feature is used, for example, to store PDF annotations, or to add new pages while editing the file.

    The main idea of the ISA is to use the same technique for changing elements, such as texts, or whole pages included in the signed PDF file to what the attacker desires.
    In other words, an attacker can redefine the document's structure and content using the Body Updates part. The digital signature within the PDF file protects precisely the part of the file defined in the ByteRange. Since the incremental saving appends the Body Updates to the end of the file, it is not part of the defined ByteRange and thus not part of the signature's integrity protection. Summarized, the signature remains valid, while the Body Updates changed the displayed content.
    This is not forbidden by the PDF specification, but the signature validation should indicate that the document has been altered after signing.

    Signature Wrapping Attack (SWA)

    Independently of the PDFs, the main idea behind Signature Wrapping Attacks is to force the verification logic to process different data than the application logic.

    In PDF files, SWA targets the signature validation logic by relocating the originally signed content to a different position within the document and inserting new content at the allocated position. The starting point for the attack is the manipulation of the ByteRange value allowing to shift the signed content to different loctions within the file.

    On a very technical level, the attacker uses a validly signed document (shown on the left side) and proceeds as follows:


    • Step 1 (optional): The attacker deletes the padded zero Bytes within the Contents parameter to increase the available space for injecting manipulated objects.
    • Step 2: The attacker defines a new /ByteRange [a b c* d] by manipulating the c value, which now points to the second signed part placed on a different position within the document.
    • Step 3: The attacker creates a new Xref table pointing to the new objects. It is essential that the byte offset of the newly inserted Xref table has the same byte offset as the previous Xref table. The position is not changeable since it is refer- enced by the signed Trailer. For this purpose, the attacker can add a padding block (e.g., using whitespaces) before the new Xref table to fill the unused space.
    • Step 4: The attacker injects malicious objects which are not protected by the signature. There are different injection points for these objects. They can be placed before or after the malicious Xref table. If Step 1 is not executed, it is only possible to place them after the malicious Xref table.
    • Step 5 (optional): Some PDF viewers need a Trailer after the manipulated Xref table, otherwise they cannot open the PDF file or detect the manipulation and display a warning message. Copying the last Trailer is sufficient to bypass this limitation.
    • Step 6: The attacker moves the signed content defined by c and d at byte offset c*. Optionally, the moved content can be encapsulated within a stream object. Noteworthy is the fact that the manipulated PDF file does not end with %%EOF after the endstream. The reason why some validators throw a warning that the file was manipulated after signing is because of an %%EOF after the signed one. To bypass this requirement, the PDF file is not correctly closed. However, it will be still processed by any viewer.

    Evaluation

    In our evaluation, we searched for desktop applications validating digitally signed PDF files. We analyzed the security of their signature validation process against our 3 attack classes. The 22 applications fulfill these requirements. We evaluated the latest versions of the applications on all supported platforms (Windows, MacOS, and Linux).


    Authors of this Post

    Vladislav Mladenov
    Christian Mainka
    Karsten Meyer zu Selhausen
    Martin Grothe
    Jörg Schwenk

    Acknowledgements

    Many thanks to the CERT-Bund team for the great support during the responsible disclosure.
    We also want to acknowledge the teams which reacted to our report and fixed the vulnerable implementations.

    Read more

    1. Hacking Raspberry Pi
    2. Growth Hacking Marketing
    3. Hacking Prank