RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1317924 - RFC: ncat failing with input/output error with ssl option
Summary: RFC: ncat failing with input/output error with ssl option
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: nmap
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Pavel Zhukov
QA Contact: Jaroslav Aster
URL:
Whiteboard:
Depends On: 1460249
Blocks: 1298243 1420851 1465887 1465928
TreeView+ depends on / blocked
 
Reported: 2016-03-15 14:10 UTC by Paulo Andrade
Modified: 2019-10-10 11:33 UTC (History)
6 users (show)

Fixed In Version: nmap-6.40-9.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 08:36:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
localhost.key (1.66 KB, text/plain)
2016-03-15 14:45 UTC, Paulo Andrade
no flags Details
localhost.pem (1.24 KB, text/plain)
2016-03-15 14:46 UTC, Paulo Andrade
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0661 0 None None None 2018-04-10 08:37:09 UTC

Description Paulo Andrade 2016-03-15 14:10:57 UTC
User can consistently reproduce the problem, even if testing
a localhost connection.

  A test case, on an environment where the problem would happen
could be (I cannot reproduce the issue in my environment):

---8<---
# mkdir /tmp/test
# cd /tmp/test
# yes us | openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.pem
# ncat  -l -p 5000  --ssl --ssl-key localhost.key --ssl-cert localhost.pem > /tmp/F;ls -l /tmp/F

<<< on a second terminal >>>

# tar --acls -C /boot -cvf - . | ncat --ssl -i 4  -4 --send-only --ssl-verify --ssl-trustfile /tmp/test/localhost.pem localhost 5000
---8<---

  The only workaround we found was to add --scpt to both ncat
commands, otherwise it would quickly fail with the message:

Ncat: Input/output error.

  I did several tests, but could not find a way to correct the
problem, until I found the "hint" about --sctp on a message, without
replies, at:

http://seclists.org/nmap-dev/2015/q4/58

and the workaround indeed corrected the problem.
The user says there is no firewall, and even validated testing
on localhost, and still got the problem. There are no logs, and
if running ncat on very verbose mode, the messages on the sending
side will look like:

---8<---
[...]
libnsock msevent_cancel(): msevent_cancel on event #92 (type TIMER)
libnsock msevent_delete(): msevent_delete (IOD #NULL) (EID #92)
libnsock msevent_new(): msevent_new (IOD #NULL) (EID #116)
libnsock nsock_timer_create(): Timer created - 4000ms from now.  EID 116
libnsock nsp_add_event(): NSE #116: Adding event
libnsock msevent_delete(): msevent_delete (IOD #2) (EID #98)
libnsock nsock_trace_handler_callback(): Callback: WRITE ERROR [Input/output error (5)] for EID 107 [111.22.3.444:5000]
Ncat: Input/output error.
---8>---

Comment 2 Michal Hlavinka 2016-03-15 14:33:30 UTC
reproducible

(In reply to Paulo Andrade from comment #0)
>   I did several tests, but could not find a way to correct the
> problem, until I found the "hint" about --sctp on a message, without
> replies, at:
> 
> http://seclists.org/nmap-dev/2015/q4/58

Unfortunately, nmap upstream does not really focus on ncat, it's more like see what our libraries can do. I've sent them patches for review a long time ago and it's very difficult to get any response from them.


----
for QE: reproducer needs also
-subj '/CN=localhost'
as openssl command, or ncat will fail with certificate verification error

Comment 3 Paulo Andrade 2016-03-15 14:45:56 UTC
Created attachment 1136642 [details]
localhost.key

sorry for the bad example creating certs, need to fill manually.
Just attaching ready ones for testing purposes.

Or, do not make the "yes us" pipe, and type:

us
us
us
us
localhost

Comment 4 Paulo Andrade 2016-03-15 14:46:20 UTC
Created attachment 1136643 [details]
localhost.pem

Comment 5 Paulo Andrade 2016-03-23 13:41:51 UTC
  Hi Michal,

  Can you attach the patches you said was sent to upstream
to the case report? Or where they not related to this issue?

  I asked the user to be 100% sure to reproduce the problem
on a localhost connection, and actually, it does not happen
in a localhost connection.

  I assumed it would fail on localhost connection, but after
user telling it works, I tested it better, and can also reproduce
the issue if connecting two hosts (and then, it works if using
--sctp).

Comment 6 Michal Hlavinka 2016-03-23 14:01:48 UTC
(In reply to Paulo Andrade from comment #5)
>   Can you attach the patches you said was sent to upstream
> to the case report? Or where they not related to this issue?
> 
They were not related to this issue. It was just to illustrate, that getting upstream response is close to impossible

for example https://github.com/nmap/nmap/issues/157 that is reported upstream with patch for a few years (first mailing list, than issue tracker) with no response

Comment 8 Daniel Miller 2017-03-19 02:32:42 UTC
I have just fixed this in Nmap upstream r36652. The problem is in the Ncat server, which was treating SSL_read identically to recv: the problem is that SSL_read can return -1 when all that is required is to try the call again. After adding code to check for this condition, the connection is maintained and transfer is successful. This will be included in the next release of Ncat/Nmap.

https://github.com/nmap/nmap/commit/ac8b866d73ca4df63c4b336253afd944d44d9c6a

Comment 20 errata-xmlrpc 2018-04-10 08:36:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0661


Note You need to log in before you can comment on or make changes to this bug.