Opened 10 years ago
Closed 10 years ago
#32063 closed defect (bug) (worksforme)
XML-RPC API doesn't allow password containing single quote
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.6 |
Component: | XML-RPC | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
I'm having an weird error on method getOptions from XML-RPC API.
My password has a single quote ('), ex: abc'cba
Method getPosts works well, returning my blog posts.
curl --header "Accept: text/xml;" --data "<?xml version="1.0"?><methodCall><methodName>wp.getPosts</methodName><params><param><value><string></string></value></param><param><value><string>MYUSERNAME</string></value></param><param><value><string>abc'cba</string></value></param></params></methodCall>" http://www.MYBLOGURL.com/xmlrpc.php
Method getOptions doesnt work at all, returning "Incorrect username or password."
curl --header "Accept: text/xml;" --data "<?xml version="1.0"?><methodCall><methodName>wp.getOptions</methodName><params><param><value><string></string></value></param><param><value><string>MYUSERNAME</string></value></param><param><value><string>abc'cba</string></value></param></params></methodCall>" http://www.MYBLOGURL.com/xmlrpc.php
If I remove the single quote from password, both methods works well.
Change History (7)
#1
@
10 years ago
- Keywords needs-testing added
- Summary changed from XML-RPC API error 403 on method getOptions with correct password to XML-RPC API doesn't allow password containing single quote
- Version changed from 4.1.2 to 2.6
#2
@
10 years ago
- Owner set to markoheijnen
- Status changed from new to assigned
I will check it out in the next day to see what goes on there.
#3
follow-up:
↓ 4
@
10 years ago
For what it's worth I tested against latest WordPress trunk, changed a user's password to "abc'cba" to match the test scenario described, and I'm able to call wp.getOptions with the password without issue. I used the exact curl command line specified except I used my localhost based URL and the username ("joez" as it happens) for my test user.
Is it possible @reprotector that your test installation has any plugins installed that might be modifying the default behavior of WordPress?
#4
in reply to:
↑ 3
@
10 years ago
Hey, @redsweater, nice to see you here :)
It happens on WordPress.com and self-hosted (Dreamhost). I've disabled all plugins and the problem persists.
Replying to redsweater:
For what it's worth I tested against latest WordPress trunk, changed a user's password to "abc'cba" to match the test scenario described, and I'm able to call wp.getOptions with the password without issue. I used the exact curl command line specified except I used my localhost based URL and the username ("joez" as it happens) for my test user.
Is it possible @reprotector that your test installation has any plugins installed that might be modifying the default behavior of WordPress?
#5
@
10 years ago
Interesting @reprotector. Sounds like it will be a real puzzle to figure out! I wonder if somehow the username has something to do with it, too?
Looking at the API code in WordPress, it doesn't seem like the login process for wp.getOptions is much different than for other methods. It's hard to imagine how it would vary.
Is it possible you've only seen the bug happening on the command line with "curl"? Maybe your shell is handling the quoted string differently than mine? I noticed one thing that seemed a little odd was the use of " quotes inside " quotes, without escaping them.
#6
@
10 years ago
- Keywords reporter-feedback added; needs-testing removed
This is working for me on a self-hosted site. Neither of the examples below (using either wp.getOptions or wp.getPosts) work on WordPress.com though, which I assume is a WordPress.com-specific authentication bug.
Two tests with the password abc"123'456
:
curl --header "Accept: text/xml;" --data "<?xml version="1.0"?><methodCall><methodName>wp.getOptions</methodName><params><param><value><string></string></value></param><param><value><string>admin</string></value></param><param><value><string>abc\"123'456</string></value></param></params></methodCall>" http://localhost/wordpress-develop/src/xmlrpc.php
<?php include ABSPATH . WPINC . '/class-IXR.php'; $rpc = new IXR_Client( "http://localhost/wordpress-develop/src/xmlrpc.php" ); $rpc->query('wp.getOptions', 0, 'admin', 'abc"123\'456' ); var_dump( $rpc );
Thanks for the report reprotector.
This needs testing and verifying. This could well have existed since forever.
Previously: #24367, #26573.