Bug 1545844

Summary: [SELinux] Firefox tabs crashing over X11 forwarding
Product: Red Hat Enterprise Linux 7 Reporter: Joe Wright <jwright>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: high Docs Contact:
Priority: low    
Version: 7.4CC: cww, lvrabec, matthew.burt, mmalik, plautrba, ssekidde, tpelka, vmojzis, zpytela
Target Milestone: rcKeywords: SELinux
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-30 12:19:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joe Wright 2018-02-15 17:02:07 UTC
Description of problem:
- Firefox tabs will crash when 

Version-Release number of selected component (if applicable):
- firefox-52.6.0-1.el7_4.x86_64
- kernel-3.10.0-693.11.6.el7.x86_64


How reproducible:


Steps to Reproduce:
1. Start VcXsrv on windows
2. Establish the X11 forwarded connection to RHEL with putty
3. Run firefox

Actual results:
- When I start up firefox, the tab crashes.  If I try a new tab and try a url, the tab crashes.

Expected results:
- firefox operates normally

Additional info:

The following appears in the terminal when running firefox over an X11 forwarded session

[user@host ~]$ firefox
[Parent 102400] WARNING: pipe error (37): Connection reset by peer: file /builddir/build/BUILD/firefox-52.6.0/firefox-52.6.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
[Parent 102400] WARNING: pipe error (44): Connection reset by peer: file /builddir/build/BUILD/firefox-52.6.0/firefox-52.6.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
[Parent 102400] WARNING: pipe error (41): Connection reset by peer: file /builddir/build/BUILD/firefox-52.6.0/firefox-52.6.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
[Parent 102400] WARNING: pipe error (40): Connection reset by peer: file /builddir/build/BUILD/firefox-52.6.0/firefox-52.6.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322

###!!! [Parent][RunMessage] Error: Channel error: cannot send/recv

[Parent 102400] WARNING: FileDescriptorSet destroyed with unconsumed descriptors: file /builddir/build/BUILD/firefox-52.6.0/firefox-52.6.0esr/ipc/chromium/src/chrome/common/file_descriptor_set_posix.cc, line 22

###!!! [Parent][MessageChannel] Error: (msgtype=0x2C0085,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv

[Parent 102400] WARNING: pipe error (38): Connection reset by peer: file /builddir/build/BUILD/firefox-52.6.0/firefox-52.6.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
[Parent 102400] WARNING: pipe error (45): Connection reset by peer: file /builddir/build/BUILD/firefox-52.6.0/firefox-52.6.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
[Parent 102400] WARNING: pipe error (43): Connection reset by peer: file /builddir/build/BUILD/firefox-52.6.0/firefox-52.6.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
[Parent 102400] WARNING: pipe error (41): Connection reset by peer: file /builddir/build/BUILD/firefox-52.6.0/firefox-52.6.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
[Parent 102400] WARNING: pipe error (42): Connection reset by peer: file /builddir/build/BUILD/firefox-52.6.0/firefox-52.6.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322

###!!! [Parent][MessageChannel] Error: (msgtype=0x2C0085,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv

We have also attempted to disable multiprocess windows with the following settings:

    browser.tabs.remote.autostart = false
    browser.tabs.remote.autostart.2 = false

Comment 4 Matt Burt 2018-02-27 15:46:41 UTC
Hi Jo,

I just came across something very similar here, and found this bugzilla while looking for a solution.

In our case we found that SELinux was involved. The following command worked for us:-

sudo setsebool mozilla_plugin_can_network_connect=1


Might be worth checking the audit log to see if something similar has happened to you.

Hope this helps,

-- 
Matt

Comment 5 Joe Wright 2018-03-13 21:10:01 UTC
Setting the boolean as provided worked.

-JW

Comment 6 Matt Burt 2018-03-14 09:31:04 UTC
Glad it worked for you Jo.

For the record, I still think this is a bug with the firefox policy. The Boolean is a bit of a blunt instrument, and is allowing more to happen than just Firefox to connect to the X server over TCP. A better solution might be to use a type enforcement rule to just allow firefox to connect to X server ports. Something like this may work:-


require {
    type mozilla_plugin_t;
    type xserver_port_t;
    class tcp_socket { name_connect };
}

allow mozilla_plugin_t xserver_port_t:tcp_socket name_connect;

Comment 8 Zdenek Pytela 2019-08-30 12:19:25 UTC
As already mentioned before, there is the mozilla_plugin_can_network_connect boolean to allow tcp name_connect:

  # semanage boolean -l|grep mozilla_plugin_can_network_connect
mozilla_plugin_can_network_connect (off  ,  off)  Allow mozilla plugin domain to connect to the network using TCP.

There is only one generic allow rule granted with the boolean set on:

  # sesearch -A -b mozilla_plugin_can_network_connect
Found 1 semantic av rules:
   allow mozilla_plugin_t port_type : tcp_socket name_connect ; 

Creating a custom SELinux policy module is recommended in environments where more strict rule is required.

Having said that, this BZ is being closed NOTABUG. Please also note the next Red Hat Enterprise Linux 7 minor release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available. If you believe that it still is a bug in SELinux policy, we recommend moving the request to Red Hat Enterprise Linux 8.