Thursday, April 16, 2020

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-16042CVE-2018-18688CVE-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.

    Related word


    1. Best Pentesting Tools 2018
    2. Hack Tool Apk No Root
    3. Pentest Tools For Ubuntu
    4. Hacking Tools Download
    5. Pentest Tools Url Fuzzer
    6. Best Hacking Tools 2019
    7. Game Hacking
    8. Hack Tools
    9. Hacker Tool Kit
    10. Nsa Hacker Tools
    11. Hacking Tools Windows 10
    12. Hacker Tools Free Download
    13. Hack Tool Apk
    14. Termux Hacking Tools 2019
    15. Hak5 Tools
    16. Hacking Tools Github
    17. Hacking Tools Usb

    The Pillager 0.7 Release

    I spent the last couple days recoding the Pillager, getting rid of bugs, optimizing code, making it more extendable and more solid overall. So this post is to release the new code.  However, with that being said, the Pillager is in mass revision right now and I added some more developers to the team to add a whole host of new database attacking features as well as moving past databases and into other areas of post exploitation pillaging. Soon to be released..  As usual this tool and any tool i create is based on my issues when performing penetration tests and solves those problems.. If you have any insight or comments i will certainly take them into consideration for future releases.

    For now check out Version 0.7.. Named searches and Data searches via external config files are now functioning properly as well as other bugs fixed along the way... Drop this in a BT5 VM and make sure you have your DB python stuff installed per the help docs and you should be good to go.  If you are looking to use oracle you are going to have to install all the oracle nonsense from oracle or use a BT4r2 vm which has most of the needed drivers minus cxoracle which will need to be installed.

    http://consolecowboys.org/pillager/pillage_0.7.zip



    Ficti0n$ python pillager.py
     
    [---] The Database Pillager (DBPillage) [---]
    [---] CcLabs Release [---]
    [---] Authors: Ficti0n, [---]
    [---] Contributors: Steponequit [---]
    [---] Version: 0.7 [---]
    [---] Find Me On Twitter: ficti0n [---]
    [---] Homepage: http://console-cowboys.blogspot.com [---]

    Release Notes:
     --Fixed bugs and optimized code
     --Added Docstrings
     --Fixed Named and Data searches from config files                 

    About:
    The Database Pillager is a multiplatform database tool for searching and browsing common
    database platforms encountered while penetration testing. DBPillage can be used to search
    for PCI/HIPAA data automatically or use DBPillage to browse databases,display data.
    and search for specified tables/data instances.
    DBpillage was designed as a post exploitation pillaging tool with a goal of targeted
    extraction of data without the use of database platform specific GUI based tools that
    are difficult to use and make my job harder.

    Supported Platforms:
            --------------------
    -Oracle
    -MSSQL
    -MYSQL
            -PostGreSQL
         

            Usage Examples:
            ************************************************************************
            
            For Mysql Postgres and MsSQL pillaging:
            ---------------------------------------
            python dbPillage -a [address] -d [dbType] -u [username] -p [password]
            
            
            For Oracle pillaging you need a SID connection string:
            ------------------------------------------------------
            python dbPillage-a [address]/[sid] -d [dbType] -u [username] -p [password]
            

            Grab some hashes and Hipaa specific:(Default is PCI)
            ------------------------------------
            python dbPillage -a [address] -d [dbType] -u [username] -p [password] --hashes -s hipaa


    Drop into a SQL CMDShell:
    -------------------------
            python dbpillage.py -a [address] -d [dbType] -u [username] -p [password] -q

    Config file specified searches:
    -------------------------------
    Search for data Items from inputFiles/data.txt:
            python dbpillage.py -a [address] -d [dbType] -u [username] -p [password] -D

    Search for specific table names from inputFiles/tables.txt:
    python dbpillage.py -a [address] -d [dbType] -u [username] -p [password] -N

         
         
            Switch Options:
            ---------------------
            -# --hashes = grab database password hashes
            -l --limit  = limit the amount of rows that are searched or when displaying data (options = any number)
            -s --searchType = Type of data search you want to perform (options:pci, hipaa, all)(PCI default)
            -u --user = Database servers username
            -p --pass = Password for the database server
            -a --address = Ipaddress of the database server
            -d --database = The database type you are pillageing (options: mssql,mysql,oracle,postgres)
            -r --report = report format (HTML, XML, screen(default))
            -N --nameSearch = Search via inputFiles/tables.txt
            -D --dataSearch = Targeted data searches per inputFiles/data.txt
    -q --queryShell = Drop into a SQL CMDshell in mysql or mssql
         
         
            Prerequisites:
            -------------
            python v2  (Tested on Python 2.5.2 BT4 R2 and BT5 R3 - Oracle stuff on BT4r2 only unless you install the drivers from oracle)
            cx_oracle (cx-oracle.sourceforge.net)
            psycopg2  (initd.org/psycopg/download/)
            MySQLdb   (should be on BT by default)
            pymssql   (should be on BT by default)
         

    Related posts


    goGetBucket - A Penetration Testing Tool To Enumerate And Analyse Amazon S3 Buckets Owned By A Domain


    When performing a recon on a domain - understanding assets they own is very important. AWS S3 bucket permissions have been confused time and time again, and have allowed for the exposure of sensitive material.

    What this tool does, is enumerate S3 bucket names using common patterns I have identified during my time bug hunting and pentesting. Permutations are supported on a root domain name using a custom wordlist. I highly recommend the one packaged within AltDNS.

    The following information about every bucket found to exist will be returned:
    • List Permission
    • Write Permission
    • Region the Bucket exists in
    • If the bucket has all access disabled

    Installation
    go get -u github.com/glen-mac/goGetBucket

    Usage
    goGetBucket -m ~/tools/altdns/words.txt -d <domain> -o <output> -i <wordlist>
    Usage of ./goGetBucket:
    -d string
    Supplied domain name (used with mutation flag)
    -f string
    Path to a testfile (default "/tmp/test.file")
    -i string
    Path to input wordlist to enumerate
    -k string
    Keyword list (used with mutation flag)
    -m string
    Path to mutation wordlist (requires domain flag)
    -o string
    Path to output file to store log
    -t int
    Number of concurrent threads (default 100)
    Throughout my use of the tool, I have produced the best results when I feed in a list (-i) of subdomains for a root domain I am interested in. E.G:
    www.domain.com
    mail.domain.com
    dev.domain.com
    The test file (-f) is a file that the script will attempt to store in the bucket to test write permissions. So maybe store your contact information and a warning message if this is performed during a bounty?
    The keyword list (-k) is concatenated with the root domain name (-d) and the domain without the TLD to permutate using the supplied permuation wordlist (-m).
    Be sure not to increase the threads too high (-t) - as the AWS has API rate limiting that will kick in and start giving an undesired return code.

    Related news

    OWASP Web 2.0 Project Update

    Some of you likely recall the talk back in 2016 or so of updating the OWASP Foundation website to not appear so much like a...well, a wiki.  That talk was carried forward into 2017 and 2018 and, with each year, the proposal got pushed ahead as there were other, deeper projects to tackle.  With the arrival of 2019 and a firm project plan under the guidance of Mike McCamon, Executive Director, we are finally moving toward a functioning, modern website that will be a whole lot less...wiki-like.  The journey has been circuitous and, while we are not anywhere near complete, we have a set plan in place to bring it to fruition within the calendar year (second quarter of the year, actually).

    TLDR: How Can You Help? 

    There are certainly ways in which you can get involved now.  For instance, we are looking for a clean way to get wiki pages into GitHub markdown format for archival.  I have done some work here but there are parsing issues with some of the tools.  Do you know a good tool or have you done similar work?  Also, are you or do you know a good designer, someone familiar with GitHub pages that can provide some useful help and feedback along the way?  A Jekyll expert to help code a theme with a handful of templates would be a great addition.  In addition, we could use website server admins who could help with assigning redirects to maintain search integrity.  Finally, there will be a great many pages to move that we will also eventually need community involvement in.  

    So, What Have We Done? 

    Thus far we have researched various ideas for standing up a new site, including modifying the current wiki, spinning up our own web server, contracting a third party to host and build a new site, and also using existing infrastructure with our own content to launch a new face for OWASP.  Our discussions led us to a familiar place, one that nearly every developer in the OWASP space is familiar with: GitHub.   

    In our conversations with GitHub, it became readily apparent that using the platform would be a win for the Foundation as well as GitHub.  Nearly everyone who runs a project at OWASP (documentation or otherwise) uses GitHub.  Because our target audience is also mostly developers we know that they are also very comfortable with the platform.  And while GitHub has a number of high profile companies using their GitHub Pages, the use of the platform as the basis for the entire website of the number one non-profit foundation in the application security sector is a big draw.

    We have run with that GitHub Pages idea and have spent internal manpower on a proof of concept.  This proof of concept is less about the UX of the site than the functionality, the ability to utilize the authentication systems, and the ability to utilize automation to push out changes quickly.

    Where Are We Now?

    We are doing the final stages of website architecture. We are also planning what needs to be in the site, how the pieces will integrate with current projects and chapters, and how we might utilize the community to integrate the pieces so that we have a visually and functionally cohesive website that spans across multiple repositories.

    What Is Next?

    We will soon be looking for a modern website design that is responsive and clean.  We will begin using the knowledge gained from our proof of concept to build out the internals of the website and then we will start implementing the highest traffic pages and administrative areas into the new platform.  Once we have the big-ticket items moved we will start looking at what is left and moving over those pieces.  The eventual goal would be to have a new, modern website for the future of OWASP while keeping the wiki as an archive of really useful information.


    We hope you are as excited as we are about the future of the OWASP Foundation website and will join us as we move toward a modern web presence.  If you have any questions or would like to volunteer your time, experience or knowledge, please contact me at harold.blankenship@owasp.com

    Read more


    1. Hacking Tools Windows 10
    2. Nsa Hack Tools Download
    3. Pentest Tools Framework
    4. Tools 4 Hack
    5. Hacking Tools Hardware
    6. Hacker Techniques Tools And Incident Handling
    7. Hacking Tools Free Download
    8. Best Hacking Tools 2020
    9. Hacking Tools For Pc
    10. Black Hat Hacker Tools
    11. Kik Hack Tools
    12. Hacker Tools For Windows
    13. Pentest Tools Find Subdomains
    14. How To Hack
    15. Pentest Tools Free
    16. Easy Hack Tools
    17. Usb Pentest Tools
    18. Pentest Tools Github

    CLOUDKiLL3R - Bypasses Cloudflare Protection Service Via TOR Browser


    CLOUDKiLL3R bypasses Cloudflare protection service via TOR Browser !

    CLOUDKiLL3R Requirements :
    • TOR Browser to scan as many sites as you want :)
    • Python Compiler

    CLOUDKiLL3R Installation ?
    Make sure that TOR Browser is up and running while working with CLOUDKiLL3R .
    Make sure that the IP AND PORT are the same in TOR Browser preferences > advanced > Networks
    Include the files below in one folder :
    • FILTER.txt
    • CK.pl
    Make Sure The Modules Below Are Installed If NOT > use this command to install one : pip install [module name]
    • argparse
    • socks
    • socket
    • requests
    • sys

    Contact :
    Twitter.com/moh_security


    More articles


    Backtrack4



    The Remote Exploit Development Team has just announced BackTrack 4 Beta. BackTrack is a Linux based LiveCD intended for security testing and we've been watching the project since the very early days. They say this new beta is both stable and usable. They've moved towards behaving like an actual distribution: it's based on Debian core, they use Ubuntu software, and they're running their own BackTrack repositories for future updates. There are a lot of new features, but the one we're most interested in is the built in Pico card support. You can use the FPGAs to generate rainbow tables and do lookups for things like WPA, GSM, and Bluetooth cracking. BackTrack ISO and VMWare images are available here.




    Related news


    1. Hacking Tools And Software
    2. Hacking Tools Usb
    3. Pentest Tools Free
    4. Hacker Search Tools
    5. Hacker Tools Apk Download
    6. Best Hacking Tools 2019
    7. Hacking Tools Download
    8. Hacking Tools Windows
    9. Wifi Hacker Tools For Windows
    10. Beginner Hacker Tools
    11. Hack Tool Apk No Root
    12. Pentest Tools Find Subdomains
    13. Hacking Tools Software
    14. Hacker Tool Kit
    15. Hack Tools Github
    16. Beginner Hacker Tools
    17. Hacker Tools Software
    18. Android Hack Tools Github
    19. Hack Tools 2019
    20. How To Hack
    21. Hack Tools For Pc
    22. Pentest Tools Linux
    23. Pentest Recon Tools
    24. Hacker Tools Free Download
    25. Hacker Tools
    26. Pentest Tools Kali Linux
    27. Pentest Tools Online

    Thank You To Volunteers And Board Members That Worked BlackHat Booth 2019

    The OWASP Foundation would like to thank the OWASP Las Vegas Chapter Volunteers for taking the time out of their busy schedule to give back and volunteer to work the booth at BlackHat 2019.  It was great meeting our Las Vegas OWASP members and working with Jorge, Carmi, Dave, and Nancy.  
    Also, take a moment to thank Global Board Members Martin Knobloch, Owen Pendlebury, and Gary Robinson for also working the booth and speaking with individuals and groups to answer questions on projects and suggestions on the use of our tools to address their work problems.
    OWASP can not exist without support from our members.  Related articles

    Grok-backdoor - Backdoor With Ngrok Tunnel Support


    Grok-backdoor is a simple python based backdoor, it uses Ngrok tunnel for the communication. Ngrok-backdoor can generate windows, linux and mac binaries using Pyinstaller.

    Disclaimer:
    All the code provided on this repository is for educational/research purposes only. Any actions and/or activities related to the material contained within this repository is solely your responsibility. The misuse of the code in this repository can result in criminal charges brought against the persons in question. Author will not be held responsible in the event any criminal charges be brought against any individuals misusing the code in this repository to break the law.

    Dependencies:
    • Python 2.7
    • Pyinstaller 3.21
    • python-pip 9.0.1

    Installation :
    pip install -r requirements.txt

    Usage:
    You need to register an acccount in ngrok.com to use this backdoor, provide Ngrok authcode while configuring the grok-backdoor. You will see a new tcp tunnel created in Ngrok status panel after the grok-backdoor server execution in victim machine.
    Create backdoor binary by running:
    python grok-backdoor.py

    Linux:


    Windows :



    You can find the output binary in grok-backdoor/dist/ directory:


    Run grok-backdoor output binary in victim machine and login to Ngrok.com control panel to see the tunnel URL:


    Telnet to tunnel URL to get the Bind shell: Enjoy shell :)


    Features:
    • Multi platform support(windows,linux,Mac)
    • Autheticated bind shell
    • Ngrok tunnel for communication

    Related links