EC-COUNCIL EC-Council Certified Secure Programmer v2 - 312-92 Exam Practice Test
Lyle is writing some code in VB.NET and is implementing some build-in security. What type of .NET security is Lyle using in the following code?
public class Myclass1
Public Sub New()
End Sub
Public Sub MyMethods()
Dim Perm As New MyPermission()
Perm.Demand()
End Sub
Pub Sub YourMethod()
End Sub
End Class
public class Myclass1
Public Sub New()
End Sub
Public Sub MyMethods()
Dim Perm As New MyPermission()
Perm.Demand()
End Sub
Pub Sub YourMethod()
End Sub
End Class
Correct Answer: C
Lori is creating a login page using Java on one of her websites with the following code.
What vulnerability or issue is the code susceptible to?
conn = pool.getConnection();
String sql = "select * from user where
username='" + "' and password='" + password +
"'";
stmt = conn.createstatement();
rs = stmt.executeQuery(sql);
if (rs.next())
{
loggedIn = true;
out.println("Successfully logged in");
}
else
{
out.println("Username and/or password not valid");
}
What vulnerability or issue is the code susceptible to?
conn = pool.getConnection();
String sql = "select * from user where
username='" + "' and password='" + password +
"'";
stmt = conn.createstatement();
rs = stmt.executeQuery(sql);
if (rs.next())
{
loggedIn = true;
out.println("Successfully logged in");
}
else
{
out.println("Username and/or password not valid");
}
Correct Answer: D
Harold is programming an application that needs to be incorporate data encryption. Harold decides to utilize an encryption algorithm that uses 4-bit working registers instead of the usual 2-bit working registers. What encryption algorithm has Harold decided to use?
Correct Answer: D
Simon is going through some of Heather's code and notices an issue. What issue did Simon find in the following code?
void f4(void * arg, size_t len)
{
char *buff = new char[100];
C *ptr = new C;
memcpy(buff, arg, len);
ptr->vf();
return;
}
void f4(void * arg, size_t len)
{
char *buff = new char[100];
C *ptr = new C;
memcpy(buff, arg, len);
ptr->vf();
return;
}
Correct Answer: B
What is the following PERL script trying to accomplish?
sub mycode_string {
join(""
map('$_ > 255 ?
sprintf("\\x{%04x]", $_) :
chr($_) = ~ /[[:cntrl:]]/ ?
sprintf(\\x%02X", $_) :
chr($_)
} unpack("u*", $_[0]))l
}
sub mycode_string {
join(""
map('$_ > 255 ?
sprintf("\\x{%04x]", $_) :
chr($_) = ~ /[[:cntrl:]]/ ?
sprintf(\\x%02X", $_) :
chr($_)
} unpack("u*", $_[0]))l
}
Correct Answer: C
Gloria is the lead operation manager for a movie production company in Las Vegas. She has been asked with ensuring that the new movie created by the company will fit on one side of a DVD disk that will be sold to the public. If the movie mentioned is a full-length production and must fit on one side of the disk, what level of compression must Gloria use?
Correct Answer: B
When a developer is creating port binding shell code, why should he/she not use the NULL characters?
Correct Answer: D
What function can be used with SQL to encrypt user supplied-passwords to that they can be compared with the encrypted passwords stored on the SQL server?
Correct Answer: A
Malory is creating a webpage in PHP where users will have to logon to gain access to certain areas of the site. Malory is concerned that malicious users might try to exploit her site, so she decides to use the following code to prevent some attacks. What is Malory trying to prevent here?
$username = addslashes($_POST["username"]);
$password = addslashes($_POST["password"]);
$username = addslashes($_POST["username"]);
$password = addslashes($_POST["password"]);
Correct Answer: C
What type of problem or error will result from the following statement?
void f2b(void * arg, size_t len)
{
char buffer[100];
long val = ...;
long *ptr = ...;
extern void (*f)();
memcpy(buff, arg, len);
*ptr = val;
f();
return;
}
void f2b(void * arg, size_t len)
{
char buffer[100];
long val = ...;
long *ptr = ...;
extern void (*f)();
memcpy(buff, arg, len);
*ptr = val;
f();
return;
}
Correct Answer: A