Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#27099 closed defect (bug) (invalid)

Input validation on wp-includes/ms-blogs.php in line 52

Reported by: OswaldoMG Owned by:
Priority: normal Milestone:
Component: General Version: 3.9
Severity: normal Keywords:
Cc: Focuses:

Description (last modified by ocean90)

Improper neutralization of directives in dynamically evaluated code.

Those lines of code allow user-controlled input to be fed directly into a function (e. g. "eval") that dynamically evaluates and executes the input as code, usually in the same interpreted language that the product uses.

Found by static analysis application.

function get_blogaddress_by_name( $blogname ) {
	if ( is_subdomain_install() ) {
		if ( $blogname == 'main' )
			$blogname = 'www';
		$url = rtrim( network_home_url(), '/' );
		if ( !empty( $blogname ) )
			$url = preg_replace( '|^([^\.]+://)|', "\${1}" . $blogname . '.', $url );
	} else {
		$url = network_home_url( $blogname );
	}
	return esc_url( $url . '/' );
}

Recommendations: Do not allow untrusted input to be evaluated or otherwise interpreted as code.

Change History (3)

#1 @ocean90
13 years ago

  • Description modified (diff)

#2 @nacin
13 years ago

  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → closed

If you're going to submit any more static code analysis tickets, please read the ticket form first:

Do not report potential security vulnerabilities here.
See the ​Security FAQ and contact security@….


This is invalid. This is a backreference, not a variable.

#3 @TobiasBg
13 years ago

$blogname is, but it's still trusted.

Note: See TracTickets for help on using tickets.