[
https://issues.apache.org/jira/browse/THRIFT-3930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15643336#comment-15643336
]
Claudius Heine commented on THRIFT-3930:
----------------------------------------
I could not reproduce this behaviour with the TestServer.
Starting TestServer:
{code}
$ bin/TestServer --protocol=json --transport=http --server-type=thread-pool
--port=9080
{code}
Sending message:
{code}
$ curl --data '[1,"0123456789",1,0,{"1":{"str":"0123456789"}}]0123456789"'
http://localhost:9080
[1,"0123456789",3,0,{"1":{"str":"Invalid method name:
'0123456789'"},"2":{"i32":1}}]
{code}
And the server logs:
{code}
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '0'.
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '1'.
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '2'.
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '3'.
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '4'.
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '5'.
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '6'.
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '7'.
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '8'.
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '9'.
Thrift: Mon Nov 7 07:55:47 2016 TConnectedClient processing exception:
Expected '['; got '"'.
{code}
But those messages only appear once for each message send via curl.
The issue with sending valid, but incomplete json message to the server was
fixed with THRIFT-3957.
You will need to set a receive time out on the socket and ConcurrentClientLimit
on the server, in order to make it more secure against DOS attacks.
> C++ JSON protocol gets unresponsive when feed with invalid data
> ---------------------------------------------------------------
>
> Key: THRIFT-3930
> URL: https://issues.apache.org/jira/browse/THRIFT-3930
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Affects Versions: 0.9.3
> Environment: Linux armv7
> Reporter: Pascal Bach
> Labels: security
>
> When I send invalid data to service via TJSONProtocol it gets unresponsive
> until all the data is processed.
> When I send for example the following string via POST:
> {{[1,"0123456789",1,0,{"1":{"str":"0123456789"}}]0123456789"}}
> The server responds with:
> {{[1,"0123456789",3,0,{"1":{"str":"Invalid method name:
> '0123456789'"},"2":{"i32":1}}]}}
> On the server side I get messages like:
> {{Thrift: Fri Jan 1 00:10:52 2010 TConnectedClient protocol exception:
> Expected '['; got '6'.}}
> This messages keep coming long after the response was already received.
> If multiple requests like the ones above are made the server is blocked for a
> long time doing nothing but printing the above mentioned messages.
> This allows to easily do denial of service towards the server.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)