Skip to content

Commit d84d9a2

Browse files
committed
Preparing the integration commit for Nov 16th release
Merge branch 'SECURITY-360-test' into security-stable-1.625
2 parents e7db526 + 6078dd7 commit d84d9a2

4 files changed

Lines changed: 38 additions & 4 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ THE SOFTWARE.
179179
<dependency>
180180
<groupId>org.jenkins-ci.main</groupId>
181181
<artifactId>remoting</artifactId>
182-
<version>2.53.3</version>
182+
<version>2.53.4-20161112.024902-1</version>
183183
</dependency>
184184

185185
<dependency>

test/src/test/java/jenkins/security/Security218CliTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ public void probeSpring2() throws Exception {
161161
probe(Payload.Spring2, -1);
162162
}
163163

164+
@PresetData(PresetData.DataSet.ANONYMOUS_READONLY)
165+
@Test
166+
@Issue("SECURITY-360")
167+
public void ldap() throws Exception {
168+
// with a proper fix, this should fail with EXIT_CODE_REJECTED
169+
// otherwise this will fail with -1 exit code
170+
probe(Payload.Ldap, PayloadCaller.EXIT_CODE_REJECTED);
171+
}
172+
164173
private void probe(Payload payload, int expectedResultCode) throws Exception {
165174
File file = File.createTempFile("security-218", payload + "-payload");
166175
File moved = new File(file.getAbsolutePath() + "-moved");

test/src/test/java/jenkins/security/security218/Payload.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
package jenkins.security.security218;
2525

2626
import jenkins.security.security218.ysoserial.payloads.*;
27-
import net.sf.json.JSON;
2827

2928

3029
/**
@@ -46,8 +45,10 @@ public enum Payload {
4645
JRMPListener(JRMPListener.class),
4746
JSON1(JSON1.class),
4847
Spring1(Spring1.class),
49-
Spring2(Spring2.class);
50-
48+
Spring2(Spring2.class),
49+
Ldap(Ldap.class),
50+
;
51+
5152
private final Class<? extends ObjectPayload> payloadClass;
5253

5354
private Payload(Class<? extends ObjectPayload> payloadClass) {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package jenkins.security.security218.ysoserial.payloads;
2+
3+
import jenkins.security.security218.ysoserial.util.PayloadRunner;
4+
5+
import java.lang.reflect.Constructor;
6+
7+
/**
8+
* @author Kohsuke Kawaguchi
9+
*/
10+
public class Ldap extends PayloadRunner implements ObjectPayload<Object> {
11+
12+
public Object getObject(final String command) throws Exception {
13+
// this is not a fully exploit, so we cannot honor the command,
14+
// but we want to check that we are blocking LdapAttribute
15+
Class<?> c = Class.forName("com.sun.jndi.ldap.LdapAttribute");
16+
Constructor<?> ctr = c.getDeclaredConstructor(String.class);
17+
ctr.setAccessible(true);
18+
return ctr.newInstance("foo");
19+
}
20+
21+
public static void main(final String[] args) throws Exception {
22+
PayloadRunner.run(Ldap.class, args);
23+
}
24+
}

0 commit comments

Comments
 (0)