• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sphinx-based Password Storage low-level library

sphinx: a password Store that Perfectly Hides from Itself (No Xaggeration)

libsphinx is a cryptographic password storage as described in https://eprint.iacr.org/2015/1099

and as presented by the Levchin Prize winner 2018 Hugo Krawczyk on Real World Crypto https://www.youtube.com/watch?v=px8hiyf81iM

What is this thing?

It allows you to have only a few (at least one) passwords that you need to remember, while at the same time provides unique 40 (ASCII) character long very random passwords (256 bit entropy). Your master password is encrypted (blinded) and sent to the password storage server which (without decrypting) combines your encrypted password with a big random number and sends this (still encrypted) back to you, where you can decrypt it (it's a kind of end-to-end encryption of passwords) and use the resulting unique, strong and very random password to register/login to various services. The resulting strong passwords make offline password cracking attempts infeasible. If say you use this with google and their password database is leaked your password will still be safe.

How is this different from my password storage which stores the passwords in an encrypted database? Most importantly using an encrypted database is not "end-to-end" encrypted. Your master password is used to decrypt the database read out the password and send it back to you. This means whoever has your database can try to crack your master password on it, or can capture your master password while you type or send it over the network. Then all your passwords are compromised. If some attacker compromises your traditional password store it's mostly game over for you. Using sphinx the attacker controlling your password store learns nothing about your master nor your individual passwords. Also even if your strong password leaks, it's unique and cannot be used to login to other sites or services.

Installing

Install python, libsodium and libsodium-dev using your operating system provided package management.

Building everything should (hopefully) be quite simple afterwards:

cd src
make

Library

libsphinx builds a library, which you can use to build your own password manager either in C/C++ or any other language that can bind to this library.

The Sphinx API

The Library exposes the following 3 functions for the FK-PTR protocol (the password storage):

void sphinx_challenge(const uint8_t *pwd, const size_t p_len, uint8_t *bfac, uint8_t *chal);
  • pwd, p_len: are input params, containing the master password and its length
  • bfac: is an output param, it's a pointer to an array of SPHINX_255_SCALAR_BYTES (32) bytes - the blinding factor
  • chal: is an output param, it's a pointer to an array of SPHINX_255_SER_BYTES (32) bytes - the challenge
int sphinx_respond(const uint8_t *chal, const uint8_t *secret, uint8_t *resp);
  • chal: is an input param, it is the challenge from the challenge() function, it has to be a SPHINX_255_SER_BYTES (32) bytes big array
  • secret: is an input param, it is the "secret" contribution from the device, it is a SPHINX_255_SCALAR_BYTES (32) bytes long array
  • resp: is an output parameter, it is the result of this step, it must be a SPHINX_255_SER_BYTES (32) byte sized array
  • the function returns 1 on error, 0 on success
int sphinx_finish(const uint8_t *pwd, const size_t p_len,
                  const uint8_t *bfac, const uint8_t *resp,
                  uint8_t *rwd);
  • pwd: is an input param, it specifies the password again.
  • p_len: is an input param, it specifies the password length
  • bfac: is an input param, it is the bfac output from challenge(), it is array of SPHINX_255_SCALAR_BYTES (32) bytes
  • resp: is an input parameter, it's the response from respond(), it is a SPHINX_255_SER_BYTES (32) byte sized array
  • rwd: is an output param, the derived (binary) password, it is a SPHINX_255_SER_BYTES (32) byte array
  • this function returns 1 on error, 0 on success

Standalone Binaries

libsphinx comes with very simple binaries implementing the sphinx protocol, so you can build your own password storage even from shell scripts. Each step in the SPHINX protocol is handled by one binary:

step 1 - challenge

The following creates a challenge for a device:

echo -n "shitty master password" | ./challenge >c 2>b

The master password is passed in through standard input.

The challenge is sent to standard output.

A blinding factor is stored in a tempfile, the name of this file is output to stderr. This tempfile is needed in the last step again.

step 2 - device responds

Pass the challenge from step 1 on standard input like:

./respond secret <c >r0

The response is sent to standard output.

step 3 - derive password

To derive a (currently hex) password, pass the response from step 2 on standard input and the filename of the tempfile from step 1 like:

fname=$(cat b) ./derive $fname <r0 >pwd0

The derived password is sent to standard output and currently is a 32 byte binary string. Please note that currently this only outputs the unblinded H(pwd)^k, for the full protocol this should be hashed again with the password prepended.

step 4 - transform into ASCII password

The output from step 3 is a 32 byte binary string, most passwords have some limitations to accept only printable - ASCII - chars. bin2pass.py is a python script in the pwdsphinx python module which takes a binary input on standard input and transforms it into an ASCII password. It can have max two parameters the classes of characters allowed ([u]pper-, [l]ower-case letters, [d]igits and [s]ymbols) and the size of the password. The following examples should make this clear:

Full ASCII, max size:

./bin2pass.py <pwd0

no symbols, max size:

./bin2pass.py uld <pwd0

no symbols, 8 chars:

./bin2pass.py uld 8 <pwd0

only digits, 4 chars:

./bin2pass.py d 4 <pwd0

only letters, 16 chars:

./bin2pass.py ul 16 <pwd0

Credits

This project was funded through the NGI0 PET Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 825310.

More Repositories

1

pysodium

wrapper for libsodium providing high level crypto primitives
Python
126
star
2

pyrsp

python implementation of the GDB Remote Serial Protocol
Python
76
star
3

libopaque

c implementation of the OPAQUE protocol with bindings for python, php, ruby, lua, zig, java, erlang, golang, js and SASL.
C
69
star
4

wireless-radar

DF and other tools to explore a 2.4GHz environment.
Python
65
star
5

pbp

salty privacy
Python
53
star
6

smeter

reading dumbmeters with gnuradio
Python
45
star
7

timecloud

jQuery Timecloud - a javascript visualization widget
JavaScript
35
star
8

utterson

a minimal static blog generator written using old-school unix tools (make, ksh, m4, awk, procmail and a pinch of elisp)
Shell
35
star
9

flask-tlsauth

flask extension for doing TLS client cert authentication
Python
31
star
10

libsaxolotl

axolotl based on libsodium
C
23
star
11

urlclean

module that resolves and cleans up urls
Python
23
star
12

tlsauth

a simple framework for nginx based tls auth with a flask example
Python
22
star
13

pwd.sh

a simple password manager
Shell
19
star
14

stash

a private dropbox
Python
17
star
15

px1000cr

Files related to PoC||GTFO 21:21 - NSA’s Backdoor of the PX1000-Cr
Python
16
star
16

pwdsphinx

python bindings for libsphinx, a reference client/server and a native backend for web-extensions for Sphinx-based password storage
Python
13
star
17

nnmon

a bugtracker for teh internetz
JavaScript
12
star
18

le-n-x

aka Pippi Longstrings
Python
10
star
19

gpk

automatically generate pgp keys
Shell
10
star
20

stfs

st filesystem for embedded flash systems
C
10
star
21

ksh-scraper

scraper for the hungarian statistics office
Python
9
star
22

liboprf

library providing OPRF and Threshold OPRF based on libsodium
C
9
star
23

cryptokraaken

scans for OpenPGP encrypted messages and key material
Python
8
star
24

pitchforkedsphinx

SPHINX based password protocol
JavaScript
8
star
25

grindr

tools to interact with websites, feeds and im
8
star
26

idapro-cortex-m-hwregs

An IDA Pro plugin that sets up the addresses and structures for Cortex M series MCUs (currently stm32f2xx only)
C
8
star
27

nb-fomu-hw

non-blinky fomu hello world (fpga usb uart demos)
Verilog
7
star
28

torpy

tool and python module to manipulate tor hidden services
Python
7
star
29

websphinx-firefox

Firefox Addon for Sphinx-based password storage
JavaScript
7
star
30

magnus23

shell ircbot based on John-Henry used on telecomix #telekompaketet
Shell
6
star
31

kernelbuild

builds automatically a kernel with grsec and tpsmapi for lenovo thinkpads
Shell
6
star
32

ctrace

dp3t covid19 contact tracer based on zephyr os for nrf51
C
5
star
33

mcabber

unofficial fork of http://mcabber.com
C
5
star
34

burnstation2

this is a fork of pyjama - changed to act as a burnstation
Python
5
star
35

saxolotl

salty axolotl ratchet
Python
5
star
36

pywik

webserver log analyzer
Python
5
star
37

aports-ugly

ugly apkbuilds for alpine linux
Shell
5
star
38

zphinx-zerver

a sphinx server in zig
Python
5
star
39

cr3

simple pipe using crazy/crappy crypto for encryption and signing
C
5
star
40

opaque-store

simple opaque based online store of small blobs
Python
4
star
41

ngx_http_auth_sasl_module

SASL authentication module for nginx
C
4
star
42

credlib

credlib is a credential library providing a simple interface to Brands credentials (by Dr Stefan Brands), and also Chaumian credentials (by Dr David Chaum). The library is based on openSSL.
C
4
star
43

sasl-opaque

Specification of OPAQUE SASL Mechanism
Makefile
4
star
44

pkrecover

recovers pgp rsa pubkeys from two signed blobs
Python
4
star
45

klutshnik

data-at-rest encryption and generic (t)OPRF server and client
C
4
star
46

arduino-cli

develop for arduinos without java
Python
4
star
47

wshare

lightweight network sharing - share your mobile connection via wifi
3
star
48

minijail

fork of chromiumos minijail
C
3
star
49

epc2203

gathers information from epc2203 cable modems (munin plugin inclusive)
Python
2
star
50

maelstrom

visualizing email contacts (dataretention)
PHP
2
star
51

tunnel-daemons

runit scripts for building tunnels
Shell
2
star
52

websphinx-chrom

Chrom* Addon for Sphinx-based Password Storage
JavaScript
2
star
53

hgpoison

poison your strings with unicode homoglyphs
Python
2
star
54

django-tlsauth

django app for doing TLS client cert authentication
Python
2
star
55

obfuscat

simple tool to handle code-phrase mappings
Python
2
star
56

tubetest

shell based network traffic test
JavaScript
2
star
57

ed448goldilocks

Fork of git://git.code.sf.net/p/ed448goldilocks/code with "support" of cross-compiling with mingw
C
2
star
58

pitchfork-5x5

a small font for small displays
C
2
star
59

privacy-challenge

parts of the ono privacy challenge
Python
2
star
60

eumirror

chapter files for videos from eu institutions
2
star
61

mepranking

ranks meps according to perfomance on various policyfields.
Python
2
star
62

kchain

is a set of scripts that help to keep all encryption keys on a USB stick
Shell
1
star
63

Persistent-Crypto-Dictionary

An encrypted persistent dictionary
Python
1
star
64

daemonize

create a simple skeleton for runit/daemontools services
Shell
1
star
65

tmsg

very simple tor-based chat and file sharing
Shell
1
star
66

herrnilsson

a mediawiki bot that imports parltrack dossiers
Python
1
star
67

libtcn

implementation of Temporary Contact Numbers from the TCNCoalition
C
1
star
68

swram

swarm simulation
Erlang
1
star
69

ec-experts

expert groups mining
Python
1
star
70

stm103-rfm12b

simple transmitter on a stm103 using an rfm12b, and a receiver using gnuradio and an rtl-sdr
C
1
star
71

monky

minimalistic console system monitor
C
1
star
72

MACC

multi agent encrypted communication PoC
Shell
1
star
73

pc-mailer

the mailserver of the the privacy challenge
Python
1
star
74

putbag

provides expiration of access to files served by webservers
Shell
1
star
75

omnom

a replacement for del.icio.us - with snapshotting of webpages
JavaScript
1
star
76

jw

jaromils world
C++
1
star
77

pwn_the_game

prototype for a game about hacking
Python
1
star
78

i3c

ksh bindings to i3wm IPC - no dox? use the src
Shell
1
star
79

pycredlib

python bindings for credlib
Python
1
star
80

winsphinx

package native messaging backend for Windows 64
Makefile
1
star
81

certcheck

educating users shaming browsers on handling https certs
HTML
1
star
82

objchanges

diffs and patches python objects
Python
1
star
83

stm32f407Vxxx-devboard

devboard for stm32f40xVx cpus
IDL
1
star
84

kuka-yoga

KUKA Robot C2 example using interrupts controlled via serial port
1
star
85

s6-services

setups for s6
Shell
1
star