Giter Club home page Giter Club logo

rsa_ct_kip's Introduction

License: MIT Build Status

What is this for?

If you need to use an RSA SecurID software token to generate one-time passwords, and have been given an activation code and a URL like https://XXX.com:443/ctkip/services/CtkipService, this software will allow you to provision the token and save it in a format that you can use with stoken.

If you use the RSA's official software (RSA SecurID) to provision the token, it will obscure the token seed to prevent you from copying it to another computer:

"Import from Web" dialog in RSA SecurID for Windows

Requirements

Client needs Python 3.x, PyCryptoDome, and requests (which will be automatically installed with pip). stoken is needed to save the resulting tokens in a usable format. Running the fake server requires Flask as well.

Install with pip3 to automatically fetch Python dependencies. (Note that on most systems, pip invokes the Python 2.x version, while pip3 invokes the Python 3.x version.)

# Install latest development version
$ pip3 install https://github.com/dlenski/rsa_ct_kip/archive/HEAD.zip

# Install a tagged release
# (replace "RELEASE" with one of the tag/release version numbers on the "Releases" page)
$ pip3 install https://github.com/dlenski/rsa_ct_kip/archive/v0.3.zip

Provision token using client

Provide the client with the activation URL and activation code (usually 12 digits), and a file in which to save the token file. It will communicate with the RSA CT-KIP server and provision a token, then attempt to call stoken to convert the token to XML/.sdtid format:

$ rsa_ct_kip https://server.company.com:443/ctkip/services/CtkipService ACTIVATION_CODE /tmp/test.sdtid
Sending ClientHello request to server...
Received ServerHello response with server nonce (R_S = 28198dbe2c18a00335179cc5bb4eff3a) and 1024-bit RSA public key
Generated client nonce (R_C = 12bec1a6f4d09470986b485561c4d2b5)
Sending ServerFinished request to server, with encrypted client nonce...
MAC verified (0f103bc63a8819ffdbee657d042144f6)
Received ServerFinished response with token information:
  Service ID: RSA CT-KIP
  Key ID: 838999658504
  Token ID: 838999658504
  Token User:
  Expiration date: 2020-01-23T00:00:00+00:00
  OTP mode: 8 Decimal, every 60 seconds
  Token seed: 30ade1be20b3867d967bd2927c8eb0ca
Saved token in XML/.sdtid format to /tmp/test.sdtid

If stoken is not installed in your path, or fails to execute successfully, then a template file will be left behind instead. Convert the template output to an RSA SecurID token in XML format with a working copy of stoken, as instructed:

$ stoken export --random --sdtid --template=template.xml > 838999658504.sdtid

Fake server

The server (invoked with python3 -m rsa_ct_kip.fakeserver) mimics a "real" RSA CT-KIP server and can be used for interoperability testing with a "real" RSA SecurID client. It accepts the requests sent by the client software at two different paths: / for laziness, and /ctkip/services/CtkipService in case any real client hard-codes this path.

It provisions tokens with randomly-generated 12-digit IDs, and random seeds, which it does not retain. Official RSA SecurID clients for Windows and for Android have been verified to connect to it, and to provision tokens from its output.

The server can run either via HTTP or HTTPS. For HTTPS, create a server.pem file in the same directory. It must contain a trusted, signed certificate in order for the RSA SecurID app to connect to it.

The package also includes rsaprivkey.pem, used by the fake server. This the RSA private key used for token generation, and shouldn't need to be modified for testing purposes. (The one included is a 1024-bit key with modulus 65537, similar to what seem to be used by the "real" RSA CT-KIP server).

Protocol

The protocol used here is allegedly documented in the RFC4758 "draft standard". There are numerous problems with this protocol:

  • The draft RFC is convoluted, overly-complex, and unclear. It's obviously an attempt to describe the operation of an existing program rather than to design a useful protocol.
  • The only "existing implementations" are in RSA's closed-source software. I use scare quotes because the actual implementations use algorithms that differ in several ways, making it impossible to interoperate without reverse-engineering.
  • The exchange is wrapped in several unnecessary layers of base64+XML+SOAP terribleness… but the official RSA clients don't really parse XML: they just pretend to, and get confused by whitespace differences and similar trivialities.
  • The protocol appears to be trying to solve the following problem, "How can a client and server agree on a long-term key (the token secret) in such a way that if the exchange is MITMed, they can't arrive at the same long-term key?" There are numerous things that make this scheme impractical and confusing and unmaintable, but the icing on the cake is that the official clients don't even give a usefully distinctive error message when they are being MITMed.

Dear RSA: This is one of the most insanely idiotic protocols I have ever seen. At no point in its rambling, incoherent design is it even close to serving a rational purpose. Everyone involved in reverse engineering it is now dumber for having studied it. I award you no points, and may God have mercy on your souls.

Credits

TODO

  • Convert raw seed into usable token without invoking stoken?

License

MIT

rsa_ct_kip's People

Contributors

adedomin avatar cemeyer avatar dlenski avatar rgerganov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rsa_ct_kip's Issues

Error handling issues

I just tried this with an obsolete activation code, and the program exist with a Traceback instead of something more useful. Buried in the text is the real message, so it's cosmetic, but it would be nice to clean it up.

Traceback (most recent call last):
  File ".local/bin/rsa_ct_kip", line 11, in <module>
    load_entry_point('rsa-ct-kip==0.4', 'console_scripts', 'rsa_ct_kip')()
  File "/home/me/.local/lib64/python3.6/site-packages/rsa_ct_kip/client.py", line 113, in main
    pd_res1, res1 = soap.parse_ServerResponse(raw_res1)
  File "/home/me/.local/lib64/python3.6/site-packages/rsa_ct_kip/client.py", line 64, in parse_ServerResponse
    raise RuntimeError(faultcode, faultstring)
RuntimeError: ('soapenv:Server.userException', 'java.rmi.RemoteException: The CT-KIP Web Service failed to process a client request. com.rsa.command.exception.InsufficientPrivilegeException: Invalid authorization code.; nested exception is: \n\tcom.rsa.command.exception.InsufficientPrivilegeException: Invalid authorization code.')

Generated Token is not correct

Hello!

Thank you very much for providing this - very useful piece of software :-)

I ran into an issue however, where the generated tokens don't work... In order to get them working, I had to:

  • Token is created as a (default) 8-digit token, even though it should be an 6-digit token
  • DefAddPIN is not placed in the template-file, causing the user to be asked to provide a PIN (or 0000 for no PIN).
  • Token-name is not included in the template

I'm assuming that this might be due to the data transmitted by the server not being exactly formatted as expected by the client... But generally speaking everything else is working after editing the resulting template-file before exporting/importing.

If you are interested, I can send you the -v output of me running the client - would that be helpful to look into why things didn't work as expected?

How to serve the stdid to the RSA client?

Hi, I saved the raw stdid file saved from a real RSA server, as well as the decoded one that stoken generates. Is there a way to serve it to the real RSA client via http? I saved it locally for work purposes but never really used it, but now I am regretting it (as others could see that I am not using the official RSA software client and it will invite questions from my manager).

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.