Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CVE-2011-4320 #2170

Merged
merged 3 commits into from
Dec 18, 2018
Merged

CVE-2011-4320 #2170

merged 3 commits into from
Dec 18, 2018

Conversation

zofpolkowska
Copy link
Contributor

@zofpolkowska zofpolkowska commented Dec 18, 2018

This PR addresses ejabberd CVE (https://www.cvedetails.com/cve/CVE-2011-4320/) about infinite loop causing DoS when a user from other domain publishes an item to not existent node (no node attribute).

  • Added new test suite for pubsub over s2s
  • Added 2 test cases for publish item by remote user
    • Node attribute is present
    • Without node attribute
      In both cases remote-server-not-found error should be returned

@zofpolkowska zofpolkowska changed the title Cve 2011 4320 CVE-2011-4320 Dec 18, 2018
@mongoose-im
Copy link
Collaborator

mongoose-im commented Dec 18, 2018

6037.1 / Erlang 19.3 / small_tests / 3081a7b
Reports root / small


6037.2 / Erlang 19.3 / internal_mnesia / 3081a7b
Reports root/ big
OK: 1171 / Failed: 0 / User-skipped: 52 / Auto-skipped: 0


6037.3 / Erlang 19.3 / mysql_redis / 3081a7b
Reports root/ big
OK: 2942 / Failed: 0 / User-skipped: 223 / Auto-skipped: 0


6037.5 / Erlang 19.3 / ldap_mnesia / 3081a7b
Reports root/ big
OK: 1136 / Failed: 0 / User-skipped: 87 / Auto-skipped: 0


6037.6 / Erlang 19.3 / elasticsearch_and_cassandra_mnesia / 3081a7b
Reports root/ big
OK: 445 / Failed: 0 / User-skipped: 8 / Auto-skipped: 0


6037.4 / Erlang 19.3 / odbc_mssql_mnesia / 3081a7b
Reports root/ big
OK: 2956 / Failed: 0 / User-skipped: 209 / Auto-skipped: 0


6037.8 / Erlang 20.0 / pgsql_mnesia / 3081a7b
Reports root/ big / small
OK: 2988 / Failed: 0 / User-skipped: 177 / Auto-skipped: 0


6037.9 / Erlang 21.0 / riak_mnesia / 3081a7b
Reports root/ big / small
OK: 1407 / Failed: 1 / User-skipped: 50 / Auto-skipped: 0

mod_global_distrib_SUITE:mod_global_distrib:test_pm_with_ungraceful_reconnection_to_different_server
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,<<"eve77.985148@localhost/res1">>,escalus_tcp,
          <0.24636.1>,
          [{event_manager,<0.24627.1>},
           {server,<<"localhost">>},
           {username,<<"eve77.985148">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.24627.1>},
            {server,<<"localhost">>},
            {username,<<"eve77.985148">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"eve77.985148">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"eve77.985148">>},
           {server,<<"localhost">>},
           {password,<<"password">>},
           {port,5222},
           {stream_management,true},
           {stream_id,<<"B36E2D4A2FE6FA61">>}]},
        10000],
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,138}]},
     {mod_global_distrib_SUITE,
       '-test_pm_with_ungraceful_reconnection_to_different_server/1-fun-0-',
       4,
       [{file,"mod_global_distrib_SUITE.erl"},{line,607}]},
     {escalus_story,story,4,
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
        {line,72}]},
    ...

Report log

@codecov
Copy link

codecov bot commented Dec 18, 2018

Codecov Report

Merging #2170 into master will decrease coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2170      +/-   ##
==========================================
- Coverage   78.66%   78.58%   -0.08%     
==========================================
  Files         329      329              
  Lines       28421    28421              
==========================================
- Hits        22357    22336      -21     
- Misses       6064     6085      +21
Impacted Files Coverage Δ
src/mam/mod_mam_muc_rdbms_async_pool_writer.erl 63.54% <0%> (-4.17%) ⬇️
src/mam/mod_mam_rdbms_prefs.erl 92.52% <0%> (-3.74%) ⬇️
src/rdbms/mongoose_rdbms.erl 67.21% <0%> (-2.74%) ⬇️
...c/global_distrib/mod_global_distrib_server_mgr.erl 83.09% <0%> (-2.12%) ⬇️
src/cassandra/mongoose_cassandra_worker.erl 74.38% <0%> (-0.99%) ⬇️
src/mam/mod_mam_utils.erl 82.37% <0%> (-0.68%) ⬇️
src/mod_muc_log.erl 77.69% <0%> (-0.26%) ⬇️
src/ejabberd_c2s.erl 86.79% <0%> (-0.08%) ⬇️
src/mod_bosh_socket.erl 82.17% <0%> (+0.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c42394...e3bb7ef. Read the comment docs.

Copy link
Contributor

@aleklisi aleklisi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good 👍

[{group, GN} || {GN, _, _} <- groups()].

groups() ->
lists:flatmap(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be simplified to:

[ {encode_group_name(BaseGroup, NodeTree), Opts, Cases} || {BaseGroup, Opts, Cases} <- base_groups(), NodeTree <- [<<"dag">>, <<"tree">>]]```

@mongoose-im
Copy link
Collaborator

mongoose-im commented Dec 18, 2018

6038.1 / Erlang 19.3 / small_tests / 25fca22
Reports root / small


6038.3 / Erlang 19.3 / mysql_redis / 25fca22
Reports root/ big
OK: 2942 / Failed: 0 / User-skipped: 223 / Auto-skipped: 0


6038.2 / Erlang 19.3 / internal_mnesia / 25fca22
Reports root/ big
OK: 1171 / Failed: 0 / User-skipped: 52 / Auto-skipped: 0


6038.6 / Erlang 19.3 / elasticsearch_and_cassandra_mnesia / 25fca22
Reports root/ big
OK: 445 / Failed: 0 / User-skipped: 8 / Auto-skipped: 0


6038.4 / Erlang 19.3 / odbc_mssql_mnesia / 25fca22
Reports root/ big
OK: 2982 / Failed: 2 / User-skipped: 209 / Auto-skipped: 0

mod_global_distrib_SUITE:mod_global_distrib:test_pm_with_ungraceful_reconnection_to_different_server
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,<<"eve12.895875@localhost/res1">>,escalus_tcp,
          <0.20300.3>,
          [{event_manager,<0.20291.3>},
           {server,<<"localhost">>},
           {username,<<"eve12.895875">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.20291.3>},
            {server,<<"localhost">>},
            {username,<<"eve12.895875">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"eve12.895875">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"eve12.895875">>},
           {server,<<"localhost">>},
           {password,<<"password">>},
           {port,5222},
           {stream_management,true},
           {stream_id,<<"278CDE6ED3401E31">>}]},
        10000],
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,138}]},
     {mod_global_distrib_SUITE,
       '-test_pm_with_ungraceful_reconnection_to_different_server/1-fun-0-',
       4,
       [{file,"mod_global_distrib_SUITE.erl"},{line,607}]},
     {escalus_story,story,4,
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
        {line,72}]},
    ...

Report log

mod_global_distrib_SUITE:mod_global_distrib:test_pm_with_ungraceful_reconnection_to_different_server
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,<<"eve44.640792@localhost/res1">>,escalus_tcp,
          <0.20714.3>,
          [{event_manager,<0.20705.3>},
           {server,<<"localhost">>},
           {username,<<"eve44.640792">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.20705.3>},
            {server,<<"localhost">>},
            {username,<<"eve44.640792">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"eve44.640792">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"eve44.640792">>},
           {server,<<"localhost">>},
           {password,<<"password">>},
           {port,5222},
           {stream_management,true},
           {stream_id,<<"FF197D0BD003D94C">>}]},
        10000],
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,138}]},
     {mod_global_distrib_SUITE,
       '-test_pm_with_ungraceful_reconnection_to_different_server/1-fun-0-',
       4,
       [{file,"mod_global_distrib_SUITE.erl"},{line,607}]},
     {escalus_story,story,4,
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
        {line,72}]},
    ...

Report log


6038.5 / Erlang 19.3 / ldap_mnesia / 25fca22
Reports root/ big
OK: 1136 / Failed: 0 / User-skipped: 87 / Auto-skipped: 0


6038.8 / Erlang 20.0 / pgsql_mnesia / 25fca22
Reports root/ big / small
OK: 3001 / Failed: 1 / User-skipped: 177 / Auto-skipped: 0

mod_global_distrib_SUITE:mod_global_distrib:test_pm_with_ungraceful_reconnection_to_different_server
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,<<"eve90.229516@localhost/res1">>,escalus_tcp,
          <0.21192.3>,
          [{event_manager,<0.21183.3>},
           {server,<<"localhost">>},
           {username,<<"eve90.229516">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.21183.3>},
            {server,<<"localhost">>},
            {username,<<"eve90.229516">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"eve90.229516">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"eve90.229516">>},
           {server,<<"localhost">>},
           {password,<<"password">>},
           {port,5222},
           {stream_management,true},
           {stream_id,<<"5E310E35DEC69462">>}]},
        10000],
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,138}]},
     {mod_global_distrib_SUITE,
       '-test_pm_with_ungraceful_reconnection_to_different_server/1-fun-0-',
       4,
       [{file,"mod_global_distrib_SUITE.erl"},{line,607}]},
     {escalus_story,story,4,
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
        {line,72}]},
    ...

Report log

Copy link
Contributor

@michalwski michalwski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I had only one concern regarding potential code duplication.

publish_without_node_attr_test
].

encode_group_name(BaseName, NodeTree) ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this and the following function used in pubsub_SUITE as well? If so I think it be worth move this to the pubsub_tools module and use it from both SUITEs.

@mongoose-im
Copy link
Collaborator

6040.1 / Erlang 19.3 / small_tests / 369e1af
Reports root / small

@mongoose-im
Copy link
Collaborator

mongoose-im commented Dec 18, 2018

6041.1 / Erlang 19.3 / small_tests / 23e5cea
Reports root / small


6041.2 / Erlang 19.3 / internal_mnesia / 23e5cea
Reports root/ big
OK: 1171 / Failed: 0 / User-skipped: 52 / Auto-skipped: 0


6041.3 / Erlang 19.3 / mysql_redis / 23e5cea
Reports root/ big
OK: 2942 / Failed: 0 / User-skipped: 223 / Auto-skipped: 0


6041.6 / Erlang 19.3 / elasticsearch_and_cassandra_mnesia / 23e5cea
Reports root/ big
OK: 445 / Failed: 0 / User-skipped: 8 / Auto-skipped: 0


6041.5 / Erlang 19.3 / ldap_mnesia / 23e5cea
Reports root/ big
OK: 1136 / Failed: 0 / User-skipped: 87 / Auto-skipped: 0


6041.4 / Erlang 19.3 / odbc_mssql_mnesia / 23e5cea
Reports root/ big
OK: 2956 / Failed: 0 / User-skipped: 209 / Auto-skipped: 0


6041.8 / Erlang 20.0 / pgsql_mnesia / 23e5cea
Reports root/ big / small
OK: 2988 / Failed: 0 / User-skipped: 177 / Auto-skipped: 0


6041.9 / Erlang 21.0 / riak_mnesia / 23e5cea
Reports root/ big / small
OK: 1394 / Failed: 0 / User-skipped: 50 / Auto-skipped: 0

@aleklisi aleklisi merged commit 5d42b02 into master Dec 18, 2018
@fenek fenek deleted the cve-2011-4320 branch January 4, 2019 13:18
@fenek fenek added this to the 3.2.0++ milestone Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants