Commit Graph

128 Commits

Author SHA1 Message Date
Matt Johnston
960d374e65 Fix test for !DROPBEAR_DSS
Fixes: 0e70732 ("Use faster primality testing in libtomcrypt")
2022-11-10 18:54:16 +08:00
Matt Johnston
cda8070898 Remove hmac-md5 entirely 2022-11-10 17:10:16 +08:00
Matt Johnston
e87a222ce7 Avoid hitting dropbear_lint.sh 2022-11-10 16:57:28 +08:00
Matt Johnston
787391ea3b Force DROPBEAR_DSS when fuzzing 2022-11-10 14:49:26 +08:00
Matt Johnston
0e70732e1e Use faster primality testing in libtomcrypt
This can only be used if DSS is disabled
2022-11-10 11:52:55 +08:00
Matt Johnston
50a07a4889 Just disable -Wundef for macos runners instead
The previous change to set TARGET_OS_EMBEDDED=0 didn't work
for libtommath which doesn't include Dropbear headers
2022-11-10 10:53:59 +08:00
Matt Johnston
dacc10a8cf Work around macos broken TARGET_OS_EMBEDDED
Their headers test TARGET_OS_EMBEDDED without
testing if it's defined which breaks Wundef.

Might be fixed in more recent macos, but it broke the github action.
2022-11-10 10:45:32 +08:00
Matt Johnston
963b9eafaa Add -Wundef and fix missing definitions 2022-11-10 10:19:12 +08:00
Matt Johnston
72b28448a1 Fix missing end quote in comment example 2022-11-10 10:07:41 +08:00
Matt Johnston
dc3c1a30cf Allow overriding shells for compat getusershell() 2022-11-09 18:40:10 +08:00
Matt Johnston
a7e3b06b04 Remove unused MAX_IP_LEN 2022-06-27 14:36:04 +08:00
Matt Johnston
b8669b063b Bump version to 2022.82 2022-04-01 14:43:27 +08:00
Matt Johnston
8b68eb55d9 Make SHA1 optional, implement SHA256 fingerprints
SHA256 is always compiled and only enable SHA1 when needed. Fingerprints
are always SHA256: base64 format, md5 and sha1 are removed. dbrandom now
uses sha256 its hash function.
2022-03-30 11:44:04 +08:00
Matt Johnston
6dc029f2cb Remove twofish and remnants of blowfish
Twofish CTR was never enabled by default and CBC modes are
deprecated
2022-03-30 10:23:39 +08:00
Matt Johnston
da7f77a50d Fix -Wexpansion-to-defined failure on clang
(failure introduced in previous re-exec commit)
2022-01-30 10:23:06 +08:00
Matt Johnston
c7b7c9a99d Add re-exec for server
This allows ASLR to re-randomize the address
space for every connection, preventing some
vulnerabilities from being exploitable by
repeated probing.

Overhead (memory and time) is yet to be confirmed.

At present this is only enabled on Linux. Other BSD platforms
with fexecve() would probably also work though have not been tested.
2022-01-30 10:14:56 +08:00
egor-duda
5edd2ce32e
Implement server-side support for sk-ecdsa U2F-backed keys (#142)
* Implement server-side support for sk-ecdsa U2F-backed keys

* Fix out-of-bounds read on normal ecdsa-sha2-[identifier] keys

* Fix one more potential out-of-bounds read

* Check if nistp256 curve is used in sk-ecdsa-sha2- key

It's the only allowed curve per PROTOCOL.u2f specification

* Implement server-side support for sk-ed25519 FIDO2-backed keys

* Keys with type sk-* make no sense as host keys, so they should be
disabled

* fix typo

* Make sk-ecdsa call buf_ecdsa_verify

This reduces code duplication, the SK code just handles the
different message format.

* Reduce sk specific code

The application id can be stored in signkey, then we don't need
to call sk-specific functions from svr-authpubkey

* Remove debugging output, which causes compilation errors with DEBUG_TRACE disabled

* Proper cleanup of sk_app

Co-authored-by: Matt Johnston <matt@codeconstruct.com.au>
2022-01-22 21:53:04 +08:00
Matt Johnston
043b0fbd1b Increase max window size to 10MB, fallback rather than
exiting if an invalid value is given.
2021-10-12 23:32:10 +08:00
Matt Johnston
c08177a3af Banner size should account for newlines 2021-10-12 21:29:42 +08:00
Matt Johnston
3c2436cd05 Comment on reason for DROPBEAR_MAX_PASSWORD_LEN limit 2021-10-12 21:29:25 +08:00
Matt Johnston
d852d69b50 Changelog for 2020.81 2020-10-29 21:35:50 +08:00
Matt Johnston
1a208c460b Increase MAX_PROPOSED_ALGO to 50, warn if exceeded 2020-10-23 20:53:58 +08:00
Matt Johnston
5d095e9a27 version 2020.80 2020-06-26 21:45:59 +08:00
Matt Johnston
ee4b4db816 changelog for 2020.79 2020-06-15 23:36:14 +08:00
Matt Johnston
d277f140ba merge rsa-sha256 2020-05-26 00:24:02 +08:00
Vladislav Grishenko
d3d0d60076
Add Chacha20-Poly1305, AES128-GCM and AES256-GCM support (#93)
* Add Chacha20-Poly1305 authenticated encryption

* Add general AEAD approach.
* Add chacha20-poly1305@openssh.com algo using LibTomCrypt chacha and
  poly1305 routines.

Chacha20-Poly1305 is generally faster than AES256 on CPU w/o dedicated
AES instructions, having the same key size.
Compiling in will add ~5,5kB to binary size on x86-64.

function                                             old     new   delta
chacha_crypt                                           -    1397   +1397
_poly1305_block                                        -     608    +608
poly1305_done                                          -     595    +595
dropbear_chachapoly_crypt                              -     457    +457
.rodata                                            26976   27392    +416
poly1305_process                                       -     290    +290
poly1305_init                                          -     221    +221
chacha_setup                                           -     218    +218
encrypt_packet                                      1068    1270    +202
dropbear_chachapoly_getlength                          -     147    +147
decrypt_packet                                       756     897    +141
chacha_ivctr64                                         -     137    +137
read_packet                                          543     637     +94
dropbear_chachapoly_start                              -      94     +94
read_kex_algos                                       792     880     +88
chacha_keystream                                       -      69     +69
dropbear_mode_chachapoly                               -      48     +48
sshciphers                                           280     320     +40
dropbear_mode_none                                    24      48     +24
dropbear_mode_ctr                                     24      48     +24
dropbear_mode_cbc                                     24      48     +24
dropbear_chachapoly_mac                                -      24     +24
dropbear_chachapoly                                    -      24     +24
gen_new_keys                                         848     854      +6
------------------------------------------------------------------------------
(add/remove: 14/0 grow/shrink: 10/0 up/down: 5388/0)         Total: 5388 bytes

* Add AES128-GCM and AES256-GCM authenticated encryption

* Add general AES-GCM mode.
* Add aes128-gcm@openssh.com and aes256-gcm@openssh.com algo using
  LibTomCrypt gcm routines.

AES-GCM is combination of AES CTR mode and GHASH, slower than AES-CTR on
CPU w/o dedicated AES/GHASH instructions therefore disabled by default.
Compiling in will add ~6kB to binary size on x86-64.

function                                             old     new   delta
gcm_process                                            -    1060   +1060
.rodata                                            26976   27808    +832
gcm_gf_mult                                            -     820    +820
gcm_add_aad                                            -     660    +660
gcm_shift_table                                        -     512    +512
gcm_done                                               -     471    +471
gcm_add_iv                                             -     384    +384
gcm_init                                               -     347    +347
dropbear_gcm_crypt                                     -     309    +309
encrypt_packet                                      1068    1270    +202
decrypt_packet                                       756     897    +141
gcm_reset                                              -     118    +118
read_packet                                          543     637     +94
read_kex_algos                                       792     880     +88
sshciphers                                           280     360     +80
gcm_mult_h                                             -      80     +80
dropbear_gcm_start                                     -      62     +62
dropbear_mode_gcm                                      -      48     +48
dropbear_mode_none                                    24      48     +24
dropbear_mode_ctr                                     24      48     +24
dropbear_mode_cbc                                     24      48     +24
dropbear_ghash                                         -      24     +24
dropbear_gcm_getlength                                 -      24     +24
gen_new_keys                                         848     854      +6
------------------------------------------------------------------------------
(add/remove: 14/0 grow/shrink: 10/0 up/down: 6434/0)         Total: 6434 bytes
2020-05-25 23:50:25 +08:00
Matt Johnston
701d43b859 send and handle SSH_MSG_EXT_INFO only at the correct point
- other fixes for rsa pubkey auth
- only include ext-info handling when rsa pubkey auth is compiled
2020-05-24 14:16:58 +08:00
Matt Johnston
7dc2f36c3e use sigtype where appropriate 2020-04-06 23:18:26 +08:00
Vladislav Grishenko
3d12521735
Add Ed25519 support (#91)
* Add support for Ed25519 as a public key type

Ed25519 is a elliptic curve signature scheme that offers
better security than ECDSA and DSA and good performance. It may be
used for both user and host keys.

OpenSSH key import and fuzzer are not supported yet.

Initially inspired by Peter Szabo.

* Add curve25519 and ed25519 fuzzers

* Add import and export of Ed25519 keys
2020-03-12 00:09:45 +08:00
Matt Johnston
fa116e983b Rename EPKA -> Plugin 2019-05-15 21:59:45 +08:00
fabriziobertocci
8c6aaf8d36 External Public-Key Authentication API (#72)
* Implemented dynamic loading of an external plug-in shared library to delegate public key authentication

* Moved conditional compilation of the plugin infrastructure into the configure.ac script to be able to add -ldl to dropbear build only when the flag is enabled

* Added tags file to the ignore list

* Updated API to have the constructor to return function pointers in the pliugin instance. Added support for passing user name to the checkpubkey function. Added options to the session returned by the plugin and have dropbear to parse and process them

* Added -rdynamic to the linker flags when EPKA is enabled

* Changed the API to pass a previously created session to the checkPubKey function (created during preauth)

* Added documentation to the API

* Added parameter addrstring to plugin creation function

* Modified the API to retrieve the auth options. Instead of having them as field of the EPKASession struct, they are stored internally (plugin-dependent) in the plugin/session and retrieved through a pointer to a function (in the session)

* Changed option string to be a simple char * instead of unsigned char *
2019-05-15 21:43:57 +08:00
Matt Johnston
4318631dd6 Bump to 2019.78 2019-03-27 21:47:34 +08:00
Matt Johnston
71f818262c 2019.77 2019-03-23 21:46:29 +08:00
Matt Johnston
8b4f60a7a1 limit password length to 100 2019-03-21 00:09:07 +08:00
Matt Johnston
ad3eacf3d6 Merge bugfix delay invalid users 2018-08-23 23:43:45 +08:00
Matt Johnston
90f04384ee fix error message to say localoptions.h 2018-08-23 22:10:07 +08:00
Matt Johnston
a60725740b workaround memory sanitizer FD_ZERO false positives 2018-03-06 21:51:51 +08:00
Matt Johnston
26ad6853d2 Only use malloc wrapper if fuzzing 2018-03-01 23:46:24 +08:00
Matt Johnston
64bd345a5d Bump version 2018-02-27 22:21:48 +08:00
Matt Johnston
36ccfd21e7 Fix restricted group code for BSDs, move to separate function 2018-02-26 21:17:13 +08:00
Matt Johnston
34ee326075 clean up some default options
- move hmac-sha2-512, hmac-md5, twofish_ctr to sysoptions.h, off by default
- try and improve text for KEX methods
2018-02-18 22:27:51 +08:00
Matt Johnston
c2f2f2b817 rename some options and move some to sysoptions.h 2018-02-18 00:29:17 +08:00
Michael Witten
3ee685ad1c options: Complete the transition to numeric toggles (`#if')
For the sake of review, this commit alters only the code; the affiliated
comments within the source files also need to be updated, but doing so
now would obscure the operational changes that have been made here.

* All on/off options have been switched to the numeric `#if' variant;
  that is the only way to make this `default_options.h.in' thing work
  in a reasonable manner.

* There is now some very minor compile-time checking of the user's
  choice of options.

* NO_FAST_EXPTMOD doesn't seem to be used, so it has been removed.

* ENABLE_USER_ALGO_LIST was supposed to be renamed DROPBEAR_USER_ALGO_LIST,
  and this commit completes that work.

* DROPBEAR_FUZZ seems to be a relatively new, as-yet undocumented option,
  which was added by the following commit:

    commit 6e0b539e9c
    Author: Matt Johnston <matt@ucc.asn.au>
    Date:   Tue May 23 22:29:21 2017 +0800

        split out checkpubkey_line() separately

  It has now been added to `sysoptions.h' and defined as `0' by default.

* The configuration option `DROPBEAR_PASSWORD_ENV' is no longer listed in
  `default_options.h.in'; it is no longer meant to be set by the user, and
  is instead left to be defined in `sysoptions.h' (where it was already being
  defined) as merely the name of the environment variable in question:

    DROPBEAR_PASSWORD

  To enable or disable use of that environment variable, the user must now
  toggle `DROPBEAR_USE_DROPBEAR_PASSWORD'.

* The sFTP support is now toggled by setting `DROPBEAR_SFTPSERVER', and the
  path of the sFTP server program is set independently through the usual
  SFTPSERVER_PATH.
2018-02-16 23:13:47 +08:00
Matt Johnston
4b021ae6f0 Remove none cipher 2018-02-09 23:40:23 +08:00
Matt Johnston
65115b9159 Merge pull request #45 from bengardner/DROPBEAR_LISTEN_BACKLOG
sysoptions.h: Add ability to override DROPBEAR_LISTEN_BACKLOG
2017-06-25 23:22:11 +08:00
Ben Gardner
44f36d57e6 sysoptions.h: Add ability to override DROPBEAR_LISTEN_BACKLOG
This change allows adding DROPBEAR_LISTEN_BACKLOG to localoptions.h to
force the value.
2017-06-05 08:40:48 -05:00
Matt Johnston
83b2c899f5 increase min DSS and RSA lengths 2017-06-16 22:35:32 +08:00
Matt Johnston
45b27b0194 merge 2017.75 2017-05-18 22:59:38 +08:00
Matt Johnston
96dfbc882d bump version to 2017.75 2017-05-17 23:57:58 +08:00
Matt Johnston
c6e912f9e2 merge 2016.74 2016-07-21 23:38:42 +08:00