Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit 13d598e

Browse files
authored
Release 2.13.1 (#1270)
2 parents d797509 + d36b137 commit 13d598e

File tree

4 files changed

+95
-39
lines changed

4 files changed

+95
-39
lines changed

LiteLoader/include/liteloader/Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#define LITELOADER_VERSION_MAJOR 2
88
#define LITELOADER_VERSION_MINOR 13
9-
#define LITELOADER_VERSION_REVISION 0
9+
#define LITELOADER_VERSION_REVISION 1
1010
#define LITELOADER_VERSION_COMMIT_SHA UNKNOWN
1111
#define LITELOADER_VERSION_STATUS LITELOADER_VERSION_DEV
1212
#define LITELOADER_VERSION_STATUS_VERSION 0

LiteLoader/include/llapi/mc/ExtendedStreamReadResult.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
struct ExtendedStreamReadResult {
1818

1919
#define AFTER_EXTRA
20+
ExtendedStreamReadResult(StreamReadResult result, std::string resultContext) {
21+
this->result = result;
22+
this->resultContext = resultContext;
23+
}
2024
StreamReadResult result;
2125
std::string resultContext;
2226
#undef AFTER_EXTRA

LiteLoader/src/liteloader/BuiltinBugFix.cpp

Lines changed: 83 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,17 @@ TInstanceHook(void, "?moveSpawnView@Player@@QEAAXAEBVVec3@@V?$AutomaticID@VDimen
173173
return original(this, pos, dimid);
174174
fixPlayerPosition(this, false);
175175
}
176-
// 这个函数没有了,我也不知这个修的是啥,就注释了
177-
//TClasslessInstanceHook(__int64,
178-
// "?move@ChunkViewSource@@QEAAXAEBVBlockPos@@H_NW4ChunkSourceViewGenerateMode@@V?$function@$$"
179-
// "A6AXV?$buffer_span_mut@V?$shared_ptr@VLevelChunk@@@std@@@@V?$buffer_span@I@@@Z@std@@@Z",
180-
// BlockPos a2, int a3, unsigned __int8 a4, int a5, __int64 a6) {
181-
// if (validPosition(a2))
182-
// return original(this, a2, a3, a4, a5, a6);
183-
// fixPlayerPosition(movingViewPlayer);
184-
// return 0;
185-
//}
176+
177+
TClasslessInstanceHook(
178+
__int64,
179+
"?move@ChunkViewSource@@QEAAXAEBVBlockPos@@H_NW4ChunkSourceViewGenerateMode@@V?$function@$$A6AXV?$buffer_span_mut"
180+
"@V?$shared_ptr@VLevelChunk@@@std@@@@V?$buffer_span@I@@@Z@std@@PEBM@Z",
181+
BlockPos a2, int a3, bool a4, enum class ChunkSourceViewGenerateMode a5, void* a6, void* a7, const float* a8) {
182+
if (validPosition(a2))
183+
return original(this, a2, a3, a4, a5, a6, a7, a8);
184+
fixPlayerPosition(movingViewPlayer);
185+
return 0;
186+
}
186187

187188
TInstanceHook(void, "?move@Player@@UEAAXAEBVVec3@@@Z", Player, Vec3 pos) {
188189
if (validPosition(pos))
@@ -191,6 +192,53 @@ TInstanceHook(void, "?move@Player@@UEAAXAEBVVec3@@@Z", Player, Vec3 pos) {
191192
this->kick("error move");
192193
}
193194

195+
// Built-in packet filter
196+
// #include "llapi/mc/NetworkPeer.hpp"
197+
// #include "llapi/mc/NetworkConnection.hpp"
198+
// static inline bool checkPktId(unsigned int id) {
199+
// id &= 0x3ff;
200+
// return id==0 || id == 0x01 || id == 0x5e || id == 0xc1;
201+
//}
202+
//
203+
// static inline bool& connState(void* conn) {
204+
// return dAccess<bool, 362>(conn);
205+
//}
206+
//
207+
// TInstanceHook(NetworkPeer::DataStatus,
208+
// "?receivePacket@NetworkConnection@@QEAA?AW4DataStatus@NetworkPeer@@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAVNetworkSystem@@AEBV?$shared_ptr@V?$time_point@Usteady_clock@chrono@std@@V?$duration@_JU?$ratio@$00$0DLJKMKAA@@std@@@23@@chrono@std@@@5@@Z",
209+
// NetworkConnection, string* data, __int64 a3, __int64** a4) {
210+
// auto status = original(this, data, a3, a4);
211+
// if (status == NetworkPeer::DataStatus::HasData) {
212+
// auto stream = ReadOnlyBinaryStream(*data, false);
213+
// auto packetId = stream.getUnsignedVarInt();
214+
// if (packetId == 0) {
215+
// data->clear();
216+
// return NetworkPeer::DataStatus::NoData;
217+
// }
218+
// if (!data->empty()) {
219+
// if (checkPktId(packetId)) {
220+
// connState(this) = true;
221+
// } else {
222+
// if (!connState(this)) {
223+
// data->clear();
224+
// return NetworkPeer::DataStatus::NoData;
225+
// }
226+
// }
227+
// }
228+
// }
229+
// return status;
230+
//}
231+
//
232+
// THook(void*,
233+
// "??0NetworkConnection@@QEAA@AEBVNetworkIdentifier@@V?$shared_ptr@VNetworkPeer@@@std@@V?$time_point@Usteady_clock@"
234+
// "chrono@std@@V?$duration@_JU?$ratio@$00$0DLJKMKAA@@std@@@23@@chrono@3@_NV?$NonOwnerPointer@VIPacketObserver@@@"
235+
// "Bedrock@@AEAVScheduler@@@Z",
236+
// void* thi, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7) {
237+
// auto res = original(thi, a1, a2, a3, a4, a5, a6,a7);
238+
// connState(thi) = false;
239+
// return res;
240+
//}
241+
194242
// Fix wine stop
195243
TClasslessInstanceHook(void, "?leaveGameSync@ServerInstance@@QEAAXXZ") {
196244
original(this);
@@ -302,9 +350,8 @@ TClasslessInstanceHook(
302350
return original(this, a2, a3, a4, a5, a6, a7, a8, a9);
303351
}
304352

305-
// Try Fix BDS Crash
353+
// Try fixing BDS crash
306354
// Beta
307-
308355
THook(void*, "??0ScopedTimer@ImguiProfiler@@QEAA@PEBD0_N@Z", void* self, char* a2, char* a3, char a4) {
309356
if (ll::globalConfig.enableFixBDSCrash) {
310357
return nullptr;
@@ -405,6 +452,7 @@ TInstanceHook(std::shared_ptr<class ChunkViewSource>,
405452
auto result = ChunkViewSource(chunkSource, ChunkSource::LoadMode::Deferred);
406453
return std::make_shared<ChunkViewSource>(result);
407454
}
455+
408456
/*
409457
// Fix carried item display
410458
// Fix armor display
@@ -463,25 +511,28 @@ TClasslessInstanceHook(void, "?sendEvent@ActorEventCoordinator@@QEAAXAEBV?$Event
463511
}
464512
}
465513
*/
466-
// Fix LevelChunkPacket crash
467-
#include "llapi/mc/LevelChunkPacket.hpp"
468-
469-
TInstanceHook(StreamReadResult, "?_read@LevelChunkPacket@@EEAA?AW4StreamReadResult@@AEAVReadOnlyBinaryStream@@@Z",
470-
LevelChunkPacket, ReadOnlyBinaryStream* bs) {
471-
size_t readPointer = bs->getReadPointer();
472-
bs->getVarInt();
473-
bs->getVarInt();
474-
unsigned int varInt = bs->getUnsignedVarInt();
475-
if (varInt != -2) {
476-
bs->getUnsignedVarInt();
477-
}
478-
bool boolean = bs->getBool();
479-
if (boolean) {
480-
varInt = bs->getUnsignedVarInt();
481-
if (varInt > 10000) {
482-
return StreamReadResult::Valid;
483-
}
514+
// Fix horion client's crash module
515+
#include "llapi/mc/PlayerListPacket.hpp"
516+
#include "llapi/mc/ExtendedStreamReadResult.hpp"
517+
518+
TInstanceHook(ExtendedStreamReadResult,
519+
"?readExtended@PlayerListPacket@@UEAA?AUExtendedStreamReadResult@@AEAVReadOnlyBinaryStream@@@Z",
520+
PlayerListPacket, ReadOnlyBinaryStream) {
521+
return ExtendedStreamReadResult{StreamReadResult::Valid, ""};
522+
}
523+
524+
// Fix SubClient exploit: Getting OP by using OP's xuid to join server
525+
#include "llapi/mc/SubClientLoginPacket.hpp"
526+
527+
TInstanceHook(StreamReadResult, "?_read@SubClientLoginPacket@@EEAA?AW4StreamReadResult@@AEAVReadOnlyBinaryStream@@@Z",
528+
SubClientLoginPacket, class ReadOnlyBinaryStream& binaryStream) {
529+
size_t readPointer = binaryStream.getReadPointer();
530+
unsigned int header = binaryStream.getUnsignedInt();
531+
unsigned int senderSubClientId = (header >> 10) & 3;
532+
unsigned int targetSubClientId = (header >> 12) & 3;
533+
binaryStream.setReadPointer(readPointer);
534+
if (targetSubClientId != 0 || senderSubClientId != 0) {
535+
return StreamReadResult::Valid;
484536
}
485-
bs->setReadPointer(readPointer);
486-
return original(this, bs);
537+
return original(this, binaryStream);
487538
}

RELEASE_NOTES.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
# Release 2.13.0
1+
# Release 2.13.1
22

33
![BDS 1.19.81.01](https://img.shields.io/badge/BDS-1.19.81.01-blue?style=for-the-badge) ![Protocol 582](https://img.shields.io/badge/Protocol-582-orange?style=for-the-badge)
44

5-
## Added
5+
# Notice
66

7-
feat(llse): effect method of Entity(#1225) (#1236) (by @harryxi)
8-
feat: adapt to 1.19.81 (#1237) (by @ShrBox @dreamguxiang @OEOTYAN @quizhizhe @Tsubasa6848)
7+
This version has fixed two destructive BDS vulnerabilities, please update as quickly as possible
98

9+
[//]: # (## Added)
1010
## Changed
1111

12-
refactor: add unused module.exports for BaseLib.js (#1230) (by @student_2333)
12+
- refactor: remove LevelChunkPacket hook because its vulnerability has been fixed
1313

1414
## Fixed
1515

16-
fix: fix #1232 (#1235) (by @harryxi)
16+
- fix: add hook to fix PlayerListPacket's memory leak vulnerability
17+
- fix: add hook to fix SubClient exploit

0 commit comments

Comments
 (0)