<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 22, 2017 at 6:38 PM, Victor Stinner <span dir="ltr"><<a href="mailto:victor.stinner@gmail.com" target="_blank">victor.stinner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><span class="gmail-"><div class="gmail_extra" dir="auto"><div class="gmail_quote">Le 22 juil. 2017 8:04 AM, "Serhiy Storchaka" <<a href="mailto:storchaka@gmail.com" target="_blank">storchaka@gmail.com</a>> a écrit :<blockquote class="gmail-m_-372619920228489054quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I think the only reliable way of fixing the vulnerability is rejecting or escaping (as specified in RFC 2640) CR and LF inside sent lines. Adding the support of RFC 2640 is a new feature and can be added only in 3.7. And this feature should be optional since not all servers support RFC 2640. <a href="https://github.com/python/cpython/pull/1214" rel="noreferrer" target="_blank">https://github.com/python/cpyt<wbr>hon/pull/1214</a> does the right thing.<br></blockquote></div></div><div dir="auto"><br></div></span><div dir="auto">In that case, I suggest to reject newlines in ftplib, and maybe add an opt-in option to escape newlines.</div><div dir="auto"><br></div><div dir="auto">Java just rejected newlines, no? Or does Java allows to escape them?</div><span class="gmail-HOEnZb"><font color="#888888"><div dir="auto"><br></div><div dir="auto">Victor</div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="gmail-m_-372619920228489054quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"></blockquote></div></div></font></span></div>
</blockquote></div><div class="gmail_extra"><br></div>OK, let's just reject \n then and be done with it. It's a rare use case after all.</div><div class="gmail_extra">Java just rejects \n for all commands and does not support escaping (aka RFC 2640).</div><div class="gmail_extra"><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Giampaolo - <a href="http://grodola.blogspot.com" target="_blank">http://grodola.blogspot.com</a></div><div><br></div></div></div>
</div></div>