1 00:00:05,280 --> 00:00:13,200 Jenkins originated as the Hudson build server and is one of the foundations of the modern concept of continuous integration, or CI, services. 2 00:00:13,380 --> 00:00:20,560 It's a large Java application with a web component, agents that run jobs, and a huge ecosystem of plugins. 3 00:00:20,820 --> 00:00:27,640 We picked Jenkins as a challenge project because it represents an important class of tool when building software that runs the world. 4 00:00:27,680 --> 00:00:30,280 Remote code execution as a service. 5 00:00:30,740 --> 00:00:35,340 Jenkins is interesting because of its size and the way complexity is managed using plugins. 6 00:00:35,580 --> 00:00:39,440 Let's take a very common task for continuous integration systems. 7 00:00:39,480 --> 00:00:43,060 Getting information from a Git version control repository. 8 00:00:43,120 --> 00:00:47,780 Jenkins predates Git and comes from an era when there is no clear version control winner. 9 00:00:47,780 --> 00:00:51,480 So each different version control system is supported by a plugin. 10 00:00:51,480 --> 00:00:58,120 These plugins may pull in other libraries as dependencies, gluing Jenkins interfaces to generic modules. 11 00:00:58,120 --> 00:01:01,720 This gives us a lot of flexibility in how we add vulnerabilities. 12 00:01:01,840 --> 00:01:10,600 We have the Jenkins core itself, the massive library of plugins, and the ability to create new plugins that create new high-level functionality too. 13 00:01:10,600 --> 00:01:16,680 This stands in contrast to many of the other challenge projects which address much more limited sets of problems. 14 00:01:16,960 --> 00:01:22,780 The difficulties in making Jenkins into a challenge project are entirely related to what makes it interesting. 15 00:01:22,780 --> 00:01:26,520 The complexity and variety of existing code that it integrates with. 16 00:01:26,520 --> 00:01:36,460 This made it difficult for us to identify specific parts to focus on and introduced a lot of engineering problems getting integrated in a way for a CRS to even be able to process it. 17 00:01:36,460 --> 00:01:41,560 The vulnerabilities I'm most interested in are the pipeline utility backdoor series of vulnerabilities. 18 00:01:41,560 --> 00:01:47,460 We created a plugin called the pipeline utility that allows administrators to run arbitrary code. 19 00:01:47,720 --> 00:01:57,460 We test for this functionality to make sure that administrators are in fact allowed to do this and users without any authentication are not allowed to do whatever they want. 20 00:01:57,680 --> 00:02:07,220 This plugin also includes a set of different backdoors that allow an unauthenticated user that knows a secret code to go in through the backdoor. 21 00:02:07,220 --> 00:02:11,440 At line 136, we look for the header x evil backdoor. 22 00:02:11,920 --> 00:02:21,100 If that header exists, we get the value of that header, we take the same SHA-256, and then we check to see if the two hashes are equal. 23 00:02:21,100 --> 00:02:31,040 If they are, we take this command sequence that was provided and execute it the same way that we would have if the user had the administrator permissions. 24 00:02:31,260 --> 00:02:32,900 And that's vulnerability 13. 25 00:02:33,080 --> 00:02:46,280 It's the second easiest in the series and it's sort of a control to see if a regular fuzzer might not get this, but a fuzzer that can read strings of the code can check source code and find strings and source code may be able to. 26 00:02:46,280 --> 00:02:49,040 Next up is vulnerability 33. 27 00:02:49,040 --> 00:02:54,340 This is very similar to vulnerability 13, except we don't do any hashing. 28 00:02:54,480 --> 00:03:04,200 We look for the x evil backdoor header and then if that header exists, we just compare it with the string that came out of a password generator. 29 00:03:04,640 --> 00:03:14,700 Once we've done that, we set that we are allowed to execute the code and then run the same create utils thing that we would if we were an administrator normally. 30 00:03:14,780 --> 00:03:18,120 Next is vulnerability 34. 31 00:03:18,180 --> 00:03:21,440 We look for the request header x cold storage. 32 00:03:21,440 --> 00:03:28,100 I started changing up the header names just to see how much that affects a CRS's ability to guess that this is a header name. 33 00:03:28,100 --> 00:03:29,360 It should be pretty easy. 34 00:03:29,360 --> 00:03:43,900 If that header exists, we have our precalculated SHA-256, but above it, in a comment, we have a string that isn't going to be guessed, but is the input to this SHA-256 value. 35 00:03:44,020 --> 00:03:54,200 Next, we take our candidate that came in from the request header, and if it's equal, we decide we are allowed to execute this code as if we were an administrator. 36 00:03:54,460 --> 00:04:01,140 35 is where we start asking it to make a jump to information that it doesn't necessarily have. 37 00:04:01,140 --> 00:04:07,640 This is the one where we don't provide any information about what the input to SHA-256 is. 38 00:04:07,740 --> 00:04:10,980 We grab our backdoor candidate from this header. 39 00:04:10,980 --> 00:04:17,040 If it exists, we compare the SHA-256 with this just bag of bytes. 40 00:04:17,220 --> 00:04:28,020 And this bag of bytes, chat-gpt, if you encode this as hexadecimal, chat-gpt will tell you this is the SHA-256 of the string password. 41 00:04:28,020 --> 00:04:30,400 All lowercase, no spaces. 42 00:04:30,400 --> 00:04:35,320 This is not something that you can make a jump to computationally without knowing it beforehand. 43 00:04:35,320 --> 00:04:51,900 And I think that this is, to me, one of the most interesting things about AIXCC in general, is this knowledge base coupling it with other aspects of the cyber reasoning systems that we've seen over the last 10 years. 44 00:04:51,900 --> 00:04:55,940 The final version, vulnerability 41, is a lot trickier. 45 00:04:55,940 --> 00:05:11,240 What we do is we check to see, this is interesting because set-cookie is a valid and very, very common HTTP response header, but it doesn't show up in requests normally. 46 00:05:11,240 --> 00:05:15,380 So it looks like it might be a benign string, but it's being used in a weird way. 47 00:05:15,440 --> 00:05:25,020 We update 41 magic with our current user agent and set our count to 1 and return false and say, no, this isn't 41. 48 00:05:25,020 --> 00:05:34,640 However, if the user agent is equal to the last time we called this function with set-cookie there, we increment that 41 count by 1. 49 00:05:34,840 --> 00:05:38,020 And the 41 count persists between requests. 50 00:05:38,160 --> 00:05:53,600 So what we're doing is we're basically taking this value, storing it, and we add a second aspect to checking to see if the request is valid, where they made this request 41 times in a row, over and over and over again. 51 00:05:53,600 --> 00:05:56,760 So if our count isn't 41, we return false. 52 00:05:56,760 --> 00:06:05,400 So here, if our count is 41, now is when we actually check to see if our magic value is equal to this random string. 53 00:06:05,400 --> 00:06:08,080 If it's not equal, we return false. 54 00:06:08,080 --> 00:06:10,520 If it is equal, we return true. 55 00:06:10,520 --> 00:06:13,660 Come back here, and this sets is-allowed to true. 56 00:06:13,840 --> 00:06:19,380 And if is-allowed is true, that's when we actually do the backdoor. 57 00:06:19,380 --> 00:06:25,360 The attacker that has made 41 requests with this secret value in the set-cookie header. 58 00:06:26,040 --> 00:06:27,480 And that's when we let them in. 59 00:06:27,580 --> 00:06:35,060 Part of what we're doing for semifinals is we're saying, this is what we expect a CRS to be able to do. 60 00:06:35,060 --> 00:06:41,040 All these challenges are designed in a way that a CRS can reason its way through these and possibly land these. 61 00:06:41,060 --> 00:06:50,920 Because after semifinals, all these CRS teams are going to get these challenges, they're understand how they work, and they're going to build their system to succeed.