Closed Bug 60362 Opened 26 years ago Closed 25 years ago

Cannot POST to 127.0.0.1 without PSM

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED WORKSFORME

People

(Reporter: tenthumbs, Assigned: ddrinan0264)

Details

Attachments

(1 file)

I brought this up in but 55878 but I think it should be separate. Using the attached test page, POSTing to 127.0.0.1 does absolutely nothing. My Apache server sees nothing, tcpdump shows no socket activity. If I run Mozilla through my Squid proxy, it never gets a request either. Just in case the string "localhost" is treated specially (it shouldn't) I added this line 127.0.0.1 me.local me to /etc/hosts and Mozilla has no problem POSTING to these names. Interestingly, GETs work.
WFM on netscape 6.0 official release. Fails on mozilla nightly 2000-11-15 with an error on the console of: *** Failure setting up Cartman! This is actually very similar to 55878 and prossibly a dup.
But I get no such wallet warning which is why I split it off from 55878.
If I install PSM then the POST works. It does not crash. Why PSM should be necessary is a mystery to me.
I am experiencing this while testing bug 55878, but GETs also fail. There are some notes in 55878 about a chain of related bugs, but they might not actually relate to this.
With a 112206 trunk build, POST's fail silently but GET's (with or without query strings) succeed. Changing the summary to add "without PSM". Changing component to Security:General
Assignee: gagan → mstoltz
Component: Networking → Security: General
QA Contact: tever → ckritzer
Summary: Cannot POST to 127.0.0.1 → Cannot POST to 127.0.0.1 without PSM
QA > junruh. PSM will be included in mozilla builds any day now, making this bug moot.
Assignee: mstoltz → ddrinan
Component: Security: General → Security: Crypto
QA Contact: ckritzer → junruh
Err... news://news.mozilla.org/3A26AF63.1050304@netscape.com says that PSM will not be built by default so I think this still needs to be addressed.
Where exactly is the code that special-cases 127.1? We should not take that address as the target of some protocol operation to imply PSM, even if PSM is included in the Mozilla default build soon. This bug needs more diagnosis and a target-milestone setting, please. /be
Keywords: mozilla0.8
mozilla/extensions/wallet/src/wallet.cpp
Steve, can you avoid assuming 127.1 means the submit is from "cartman"? Also, why is the PL_strncasecmp at line 3635 of password and secmanPassword passed a constant 9 as the maximum number of characters to compare? /be
Assignee: ddrinan → morse
This code is the way the cartman team recommended testing for their server. It was copied from extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp.
Brendan, this bug is not in the wallet code. The test in wallet.cpp for the cartman server has nothing to do with this failure. It was responsible for the crash in bug 55878 and that bug I fixed. In the current case, the wallet routine is called and it successfully determines that this is not a submission to cartman. The current failure, whatever it is, occurs long after the wallet routine is out of the picture. Reassigning back to form-submission.
Assignee: morse → rods
Component: Security: Crypto → Form Submission
QA Contact: junruh → vladimire
Steve: I don't care where this code was copied from. Can you say why it's right to treat 127.0.0.1 as uniquely associated with PSM? And what about the 9 passed to PL_strncasecmp? It looks like it was cloned erroneously from the previous PL_strncasecmp(host, "127.0.0.1", 9), which is itself a problem: what if host is 127.0.0.1evil.org, a perfectly valid hostname? /be
reassigning
Assignee: rods → pollmann
brendan, the code is not saying that 127.0.0.1 is uniquely associated with cartman. Rather it is saying that cartman is uniquely associated with 127.0.0.1 because that's where all the cartman ui comes from. The code checks for the url and, if that passes, it then checks for the cartman password. If both of those checks pass, then the code concludes that this must be cartman. ddrinan, since you wrote the original code, can you answer brendan's question as to why you limit you test to checking on the first 9 characters of "127.0.0.1"? brendan, yes a host such as 127.0.0.1evil.org would pass the first part of the test. And if the site was real evil and had you access it with a password that is the cartman password (which happens to be noncexxxxxxxxxxxxxxxxxx where I believe the x's are random digits), the test would be fooled. But what would the site get in return for fooling the code? It would get an alert saying "Do you want to save the information on this form." (The only reason for the test in wallet is to avoid getting that message when pressing OK on the cartman dialog that allows you to create your master password.)
The PL_strncasecmp(host, "127.0.0.1", 9) is wrong, it should be PL_strcasecmp(host, "127.0.0.1"), assuming the host part is always canonized (127.1 is a valid spelling of that address, too). The second PL_strncasecmp(password, secmanPassword, 9) is wrong too, it should be PL_strcasecmp(password, secmanPassword). Who knows what exploits could be developed given these bugs? I don't, but the code is wrong on its face and should be fixed. /be
brendan, you wrote: (127.1 is a valid spelling of that address, too) Why is that important. The cartman UI is always invoked at 127.0.0.1. So when checking for a call to the cartman UI, we never need to test for 127.1.
If no one ever uses 127.1, or if necko converts such a spelling to the canonical form (better -- anyone know if it does?), then great. This potential mismatch wasn't the main point of my comment, which remains the abuse of PL_strncasecmp where PL_strcasecmp is required, and the completely bogus 9 recurrence. /be
You people seem to be losing sight of the real issue here: Mozilla is redirecting network traffic based on a substring of a URI *without* having control over the semantics of that substring. By using "127.0.0.1", mozilla is implicitly assuming that it exerts some control over the loopback interface. That may be true for a Mac; that might be true for some flavor of Windows; that is almost certainly untrue for Linux or any Unix-like OS. Personally, I think this method is a complete crock but, if mozilla is going to do this, it must use something it controls. I could see mozilla.org deciding that the string "reserved-for-psm.mozilla.org" will never be used and making it available for mozilla's use. Anything not so reserved is just flat out not going to work. Furthermore, mozilla doesn't even test for PSM's existence. It just dies on failure. As far as I'm concerned, this is an example of a unjustified assumption and all unjustified assumptions are potential security holes. That it occurs in a security component is particularly troubling. That it occurs silently in a security component is ridiculous.
The real issue here is that you cannot post to 127.0.0.1. The fact that there is code in wallet.cpp that tests for this url has nothing to do with this failure. Wallet (or mozilla) is not assuming that it has control over that url. Rather it knows that cartman has chosen to use that url and wallet needs to know if the current usage of the url is for cartman or for some other bonafide use. So it makes the test consisting of a url check and a password check. If both matches, then wallet assumes that this is the cartman usage and it does not put up the "do you want to save" dialog. Everything else remains the same. So the problem, whatever it is, has nothing to do with wallet's url check. Until we know where the cause of the problem is, it's premature to make any judgement calls.
tenthumbs: I hope you're not lumping me into "you people", because I thought as you did, that this wallet function was preempting INADDR_LOOPBACK (yeah, I'm an old Unix hacker). It appears not to be, because it discriminates on password in the URI, as morse pointed out. Those bogus strncasecmps need to be fixed, and I haven't heard anyone sign up to fix them -- Steve, can you do it? /be
Is there a bug report filed on it?
bug 55878 seems to have the patch with the bogus PL_strncasecmps, and no record or r= or sr=. Who reviewed that patch? /be
Brendan: I certainly didn't mean to imply you are one of "them." :-) You're one of the few people who recognize that OS's often have different approaches to the same problem. I guess I needed to edit my message one more time. Now, I was indeed confused by the wallet code but I also knew that Linux mozilla talks to psm via unix domain sockets so I realized that mozilla wasn't dealing with tcp connections. Looking through extensions/psm-glue, I think I see what's happening; nsSecureBrowserUIImpl::CheckPost does some checks and calls nsSecureBrowserUIImpl::IsURLfromPSM which then checks for a functioning psm. Since psm doesn't exist, the error percolates back up and the post fails. Note that the code, as written, assumes that a test failure implies that the URI is bogus in some way; in particular, it assumes that psm's non-existence implies a URI error without ever checking for the nonce password. It should not assume that such URI's belong to it. Another way to look at it is that mozilla's psm code is trying to share a data channel with other "processes." Distinguishing psm's data from other data is hard. Notice that three different bugs are mentioned in the 42 lines of IsURLfromPSM. Obviously, this has been a problem and, I think, will continue to be. I remain convinced that this is a crock.
Assignee: pollmann → ddrinan
Since the security team now owns the psm-glue code, I will take a look at this bug. I'm reassigning to myself (ddrinan).
Keywords: mozilla0.9
Keywords: mozilla0.8.1
Keywords: mozilla0.8
This works for me on 2001-10-08-08-trunk build on linux red hat 6.2 resolving
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → WORKSFORME
hope noone minds if I resolve this, I dont think I reproduced it correctly last time, but I cannot reproduce it right now either.
Status: RESOLVED → VERIFIED
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: