1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 12:02:47 -05:00

Add an interactive anti-spoofing prompt in Plink.

At the point when we change over the seat's trust status to untrusted
for the last time, to finish authentication, Plink will now present a
final interactive prompt saying 'Press Return to begin session'. This
is a hint that anything after that that resembles an auth prompt
should be treated with suspicion, because _PuTTY_ thinks it's finished
authenticating.

This is of course an annoying inconvenience for interactive users, so
I've tried to reduce its impact as much as I can. It doesn't happen in
GUI PuTTY at all (because the trust sigil system is used instead); it
doesn't happen if you use plink -batch (because then the user already
knows that they _never_ expect an interactive prompt); and it doesn't
happen if Plink's standard input is being redirected from anywhere
other than the terminal / console (because then it would be pointless
for the server to try to scam passphrases out of the user anyway,
since the user isn't in a position to enter one in response to a spoof
prompt). So it should only happen to people who are using Plink in a
terminal for interactive login purposes, and that's not _really_ what
I ever intended Plink to be used for (which is why it's never had any
out-of-band control UI like OpenSSH's ~ system).

If anyone _still_ doesn't like this new prompt, it can also be turned
off using the new -no-antispoof flag, if the user is willing to
knowingly assume the risk.
This commit is contained in:
Simon Tatham
2019-03-10 14:42:33 +00:00
parent 76d8d363be
commit 514796b7e4
10 changed files with 140 additions and 1 deletions

View File

@ -328,6 +328,46 @@ channel.
\dt Do not sanitise server data written to Plink's standard output
channel.
\S2{plink-option-antispoof} \I{-no-antispoof}: turn off authentication spoofing protection prompt
In SSH, some possible server authentication methods require user input
(for example, password authentication, or entering a private key
passphrase), and others do not (e.g. a private key held in Pageant).
If you use Plink to run an interactive login session, and if Plink
authenticates without needing any user interaction, and if the server
is malicious or compromised, it could try to trick you into giving it
authentication data that should not go to the server (such as your
private key passphrase), by sending what \e{looks} like one of Plink's
local prompts, as if Plink had not already authenticated.
To protect against this, Plink's default policy is to finish the
authentication phase with a final trivial prompt looking like this:
\c Access granted. Press Return to begin session.
so that if you saw anything that looked like an authentication prompt
\e{after} that line, you would know it was not from Plink.
That extra interactive step is inconvenient. So Plink will turn it off
in as many situations as it can:
\b If Plink's standard input is not pointing at a console or terminal
device \dash for example, if you're using Plink as a transport for
some automated application like version control \dash then you
\e{can't} type passphrases into the server anyway. In that situation,
Plink won't try to protect you from the server trying to fool you into
doing so.
\b If Plink is in batch mode (see \k{plink-usage-batch}), then it
\e{never} does any interactive authentication. So anything looking
like an interactive authentication prompt is automatically suspect,
and so Plink omits the anti-spoofing prompt.
But if you still find the protective prompt inconvenient, and you
trust the server not to try a trick like this, you can turn it off
using the \cq{-no-antispoof} option.
\H{plink-batch} Using Plink in \i{batch files} and \i{scripts}
Once you have set up Plink to be able to log in to a remote server